面试题 17.09
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. Note that 3, 5, and 7 do not have to be factors, but it should not have any other prime factors. For example, the first several multiples would be (in order) 1, 3, 5, 7, 9, 15, 21.
Example 1:
Input: k = 5
Output: 9
Solutions
The same as
problem 264 Ugly number II
.treeset
dynamic programming or merge sorted lists
Last updated
Was this helpful?