Ugly numbers efficient program solution explained | 2 Methods

preview_player
Показать описание
This lecture explains what are ugly numbers and how to solve ugly numbers using brute-force method as well as dynamic programming method. Both the codes are given in the link below.
PLEASE help our channel by SUBSCRIBING.

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
Рекомендации по теме
Комментарии
Автор

your approach with the multiplication table is wrong, try to upload videos with right concept, otherwise it'll be confusing for others

kishalaybhattacharya
Автор

Your multiplication solution is not exactly correct. For example, 2*7 is not an ugly number. Your DP solution is correct though.The basic concept is any ugly number multiplied with 2, 3 or 5 will give an ugly number.As we only keep ugly numbers in the dp array, we will get the answer

anoopm
Автор

i think this approach deviates at a point wherein the 11th ugly number comes 2*7=14 which is incorrect, the dp solution is a thing after that but i think something is wrong in the main approach!!!

praveenchouhan
Автор

Actually 1 is also a power of those, 2 power 0 is 1, 3 power 0 is 1, 5 power 0 is 1 at(1:03)

charankumar
Автор

I don't understand the way we uptade the next number ugly number (nm2= ugly[i2] * 2). I mean, why does it work?

nocredits
Автор

Your multiplication solution is not exactly correct. For example, 2*7 is not an ugly number.

be_like__prateek
Автор

Thank you for the explanation Bhaiya :)
But your intuitive solution is misleading. In your intuitive solution, you are basically taking a minimum number from tables of 2, 3 and 5 at each iteration, by this approach, we will even have 14, 21.... and so on as an ugly number which is incorrect.
Though, final dp approach is correct.

prateekaryan
Автор

Guys, this approach is wrong. Using a multiplication table means that at some point you will insert 14(2*7) or 21(3*7) and so on, which are not ugly numbers.

animeblastford
Автор

out of thin air you thought you should use 2, 3, 5 tables ? you should've explained what made you use that method instead of just explaining the code in English.

sudheer-suri
Автор

Great videos, Really Helpful keep up the great work !!

RahulKumar-wfxx
Автор

Hello, i need to write a programto find the 1500th ugly number, without any input. (C++) Could you help me out?

jubba
Автор

Your method will give 14 as the ugly number, which is not. Please correct the error

therawbean
Автор

It's wrong this time because it will give 14 also as ugly number but it is not!! Delete the video bro!!

himanshu
Автор

everyone is jumping straight to 2, 3, 5 tables to explain the solution. How did you arrive at the table?

micromir
Автор

Don't post wrong logic and waste our time

pradeep
Автор

how to write a recursive formula for this problem? because generally for all the dp problems I have been seeing some recursive formula, why not in this problem?

saravanan
Автор

solution should be explained as per exact "dp"-approach's intitution.

ajayjangid
Автор

This approach is wrong. 7x2 = 14 This is not an ugly number

anonymoussloth
Автор

sare tutorial padh ke video banane aa jate hai bhai concept kaha hai

sonuranjansingh
Автор

How is brute force method tc is nlogn anyone pls explain

midhileshmomidi
visit shbcf.ru