LeetCode
Ugly Number II
Click
here
for an explanation.