Search
⌘K

Leetcode 1201. Ugly Number III

Find the nth positive integer that is divisible by at least one of a, b, or c. Use inclusion–exclusion with lcm(a,b,c) to count how many numbers ≤ x are divisible and binary search over x (needed since n and values can be up to 1e9).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.