← Flipkart questions

Generate the nth ugly number

Filed under Flipkart

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, find the nth ugly number in the sequence (1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ...).

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Flipkart questions

Collected from public candidate posts and coding forums. Updated Nov 2026.