logo
Interview
    Interview Guide
    Coding Problems List
Sponsored: Coursera
Problems

Ugly Number

Problem

Ugly number is a number that only have factors 3, 5 and 7.

Design an algorithm to find the Kth ugly number. The first 5 ugly numbers are 3, 5, 7, 9, 15 ...

Example

If K=4, return 9.

Challenge

O(K log K) or O(K) time.

Online Judge