` ````
```

Auto Saved.

Loading Question ...

- Total Accepted:
**55055** - Total Submissions:
**171398** - Difficulty:
**Medium** -
Contributor:
**LeetCode**

Write a program to find the `n`

-th ugly number.

Ugly numbers are positive numbers whose prime factors only include `2, 3, 5`

. For example, `1, 2, 3, 4, 5, 6, 8, 9, 10, 12`

is the sequence of the first `10`

ugly numbers.

Note that `1`

is typically treated as an ugly number, and *n* **does not exceed 1690**.

**Credits:**

Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.

Subscribe to see which companies asked this question.

Show Tags

Dynamic Programming
Heap
Math
Show Similar Problems

(H) Merge k Sorted Lists
(E) Count Primes
(E) Ugly Number
(M) Perfect Squares
(M) Super Ugly Number
Have you met this question in a real interview?

Yes

No

When did you meet this question?

last week

last month

last 3 month

last 6 month

more than 6 months

other

Which company asked you this question?

Adobe

Aetion

Affirm

Airbnb

Alation

Alibaba

Amazon

AppDynamics

Apple

Arista

Baidu

Bank of America

BlackRock

Blend Labs

Blizzard

Bloomberg

Booking

Box

Bungie

Capital One

CareerBuilder

Cisco

Citadel

Coinbase

Concur

Conviva

Coupang

Coursera

CreditEase

CVTE

Dell

Deutsche Bank

DoorDash

Dropbox

Duolingo

EasyNet

eBay

Electronic Arts

EMC

Epic Systems

Equinix

Evernote

Expedia

Facebook

FactSet

Fitbit

Flipkart

Fortinet

FourSquare

FreeWheel

GoDaddy

Goldman Sachs

Google

GrabTaxi

Groupon

HBO

Hedvig

HomeAway

HTC

Huawei

Hulu

IBG

IBM

Indeed

InnovatureLabs

Intel

IXL

Jane Street

JPMorgan

Jump Trading

Lending Club

LinkedIn

LiveRamp

Loovee

Marvel

Matlab

McKesson

Microsoft

Morgan Stanley

NetEase

Nintendo

Nutanix

Nvidia

Oracle

Orbitz

Palantir

Paypal

Pinterest

Pocket Gems

Point72

Qualcomm

Qualtrics

Qumulo

Quora

Rackspace

Redfin

Rubrik

Salesforce

Samsung

SAP

ServiceNow

Sina

Snapchat

SoftwareOne

Sony

SoundHound

Square

Sumologic

SurveyMonkey

Symantec

Tableau

Tencent

Tesorio

TinyCo

Tradeshift

TripAdvisor

Twilio

Twitter

Two Sigma

Uber

Veritas

Visa

VMware

Walmart

Wealthfront

Whitepages

Works Applications

Yahoo

Yandex

Yelp

Zappos

Zenefits

Zillow

Zynga