Generate the One-Based Sequence of Ugly Numbers

Quick Overview

Generate the One-Based Sequence of Ugly Numbers. Return the nth positive integer whose prime factors are limited to 2, 3 and 5. The first such integer is 1. Preserve the original int nthUglyNumber(int n) inter

Generate the One-Based Sequence of Ugly Numbers

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Other

### Problem Return the nth positive integer whose prime factors are limited to 2, 3 and 5. The first such integer is 1. Preserve the original int nthUglyNumber(int n) interface. ```cpp int nthUglyNumber(int n); ``` ### Examples ```text n = 12 -> 16 n = 2 -> 2 ``` ### Constraints - 1 <= n <= 1690.

Overview: Generate the One-Based Sequence of Ugly Numbers. Return the nth positive integer whose prime factors are limited to 2, 3 and 5. The first such integer is 1. Preserve the original int nthUglyNumber(int n) inter

Google logo
Google
Date not reported
mediumSoftware EngineerOtherCoding & Algorithms
0
0

Problem

Return the nth positive integer whose prime factors are limited to 2, 3 and 5. The first such integer is 1. Preserve the original int nthUglyNumber(int n) interface.

int nthUglyNumber(int n);

Examples

n = 12 -> 16
n = 2 -> 2

Constraints

  • 1 <= n <= 1690.