




Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Write a function f(k) to determine how many ugly numbers smaller than k. As f(k) is non-decreasing, try binary search.
Find all ugly numbers in [1, LCM(a, b, c)] (LCM is Least Common Multiple). Use inclusion-exclusion principle to expand the result.