Leetcode 264. Ugly Number II

preview_player
Показать описание
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

Given an integer n, return the nth ugly number.



Example 1:

Input: n = 10
Output: 12
Explanation: [1, 2, 3, 4, 5, 6, 8, 9, 10, 12] is the sequence of the first 10 ugly numbers.
Example 2:

Input: n = 1
Output: 1
Explanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.
Рекомендации по теме
Комментарии
Автор

Great explaination. Just want to point out the reason for 1 being a ugly number -
Any ugly number can be represented by (2^x) * (3^y) * (5^z) where x, y and z are integers.
If x = y = z = 0, then (2^0) * (3^0) * (5^0) = 1 * 1 * 1 = 1

AkshatJainSF
Автор

Best explanation after looking at number of videos

komalkumari-muqu
Автор

Di you explain so well. Can you please start uploading the daily leetcode challenge video.

mansigoyal
Автор

great explanation. Now this is my go to channel for Leetcode problems solution.

sujalgupta
Автор

Please do mention the Time and space complexity also for each que that you solve. That will be really helpful !

NKC_x
Автор

amazing explanation Didi Thank you😁😁👍👍🙌🙌

prathameshjadhav
Автор

Thank you for such an intuitive explanation

monismomin
Автор

beautiful explaination of ugly numbers.

satyamgupta
Автор

The description says ugly but the explanation is pretty :P

DarkKnight-gy
Автор

How u come up to this solution I am doing Leetcode from last 2 months still not able to solve without help of YouTube video. Plz tell m what should I do

yatri
Автор

question is ugly, but your explanation was beautiful :)

leepakshiyadav
Автор

great explanation
please continue in explanation problems

engmohammedmonem
Автор

Yrr I really needed this explanation ✌️😕

MilindGupta
Автор

i killed 1.5hr of time on this question, after seeing the solution, i am wondering why i took so much time on it, thanks for the explaination

ChavaliDayaSwaroop
Автор

Yes the solution is good, but what makes it better and appealing, 1. Explaining it under the limelight of your mom 2. The number of tabs on the screen.

ashwanikumarkaushik
Автор

is it only me or the video isnt synced with ur voice ?

gediontadesse
visit shbcf.ru