Results for “common”
Small, practical examples. Search by task or narrow things down below.
Calculate a least common multiple using a GCD
C: Divide before multiplying to reduce the risk of intermediate overflow.
C✓ Tested
Calculate the greatest common divisor
C: Euclid’s algorithm repeatedly replaces a pair with the divisor and remainder.
C✓ Tested
Find common factors and multiples
Python: Use the integer gcd and lcm helpers to avoid floating-point calculations.
Python✓ Tested
Find common set members
Find common set members in a complete Rust program using the standard library.
Rust✓ Tested
Find lines common to two sorted files
Linux Commands: Use comm -12 to suppress the two columns of unmatched lines.
Linux Commands✓ Tested
Find the common members of two sorted sets
C++: set_intersection requires both input ranges to be sorted under the same comparator.
C++✓ Tested
Find the greatest common divisor
Java: BigInteger.gcd calculates an exact nonnegative common divisor.
Java✓ Tested
Find the greatest common divisor with the standard library
C++: std::gcd computes a nonnegative integer common divisor.
C++✓ Tested
Find the least common multiple with the standard library
C++: std::lcm combines positive integer periods into a common cycle.
C++✓ Tested
Find values common to two collections
C#: Intersect returns distinct values shared by the inputs.
C#✓ Tested
Add calendar days in UTC
TypeScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
TypeScript✓ Tested
Await several independent results
Preserve input order while awaiting multiple promises.
Promise.all✓ Tested