LeetCode
Ugly Number III
Click
here
for an explanation.