Least Common Multiple — Solution & Editorial
Divide by the gcd BEFORE multiplying so the intermediate stays in 64 bits.
Complexity: O(log)
Watch out: A·B/gcd overflows if multiplied first — 1018 is exactly the edge.
Divide by the gcd BEFORE multiplying so the intermediate stays in 64 bits.
Complexity: O(log)
Watch out: A·B/gcd overflows if multiplied first — 1018 is exactly the edge.