1.8 Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.
能想到的就是暴力一下了。。。
貌似还有更好的办法
This is a hard problem. Don’t feel bad if you weren’t able to solve this. Does that mean it’stoo hard to be solved in an interview? Not exactly. After all, this question is here because
someone else was asked it!
When you get this question, do your best to solve it—even though it’s really difficult. Explain
a brute force approach (not as tricky) and then start thinking about how you can optimize it.
Or, try to find a pattern in the numbers.
Chances are, your interviewer will help you along when you get stuck. Whatever you do,
don’t give up! Think out loud, wonder aloud, explain your thought process. Your interviewer
will probably jump into guide you.