标签:
A classic type of problem: multi-pointer marching algorithm. For each pointer of each prime, we need to remember where it is in the ugly sequence, so that we can proceed properly.
The SAME thought as "Ugly Number II" (https://leetcode.com/discuss/55304/java-easy-understand-o-n-solution)
Non-Heap based: https://leetcode.com/discuss/72835/108ms-easy-to-understand-java-solution
Heap-based: https://leetcode.com/discuss/74284/c-300ms-solution
Actually they are the same.
Key Idea of these two problems is: new ugly number can only be produced from previous ugly number.
LeetCode "Super Ugly Number" !
标签:
原文地址:http://www.cnblogs.com/tonix/p/5050023.html