Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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.

 

posted on 2015-12-16 04:35  Tonix  阅读(181)  评论(0编辑  收藏  举报