7 Subset Sum Problem

preview_player
Показать описание
Subset Sum Problem(Dynamic Programming)
Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to given sum.
Example:

Input: set[] = {3, 34, 4, 12, 5, 2}, sum = 9
Output: True //There is a subset (4, 5) with sum 9.

------------------------------------------------------------------------------------------
Here are some of the gears that I use almost everyday:

PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.
Рекомендации по теме
Комментарии
Автор

Sir just for confirmation - 20:58 me t [ i - 1 ] hona chahiye na(Because we have processed the last element)?

keeratsachdeva
Автор

Mind blowing explanation, I usually do not comment but this sort of material needs a big applaud.

savithalakshmanan
Автор

Watched all the ads just to support you! I usually have ad blocker. You are killing it!

PrashantSedhainOfficial
Автор

7 of 50 (14%) done! Very nice explanation of initialization and the summary at the end was a great wrap-up, tying everything together.

anant
Автор

I"ve done course from coding ninjas but this playlist makes me understand dp easily, serioulsy you are an inspiration

bodlahruthik
Автор

One day your juniors of NIT Bhopal will be proud to have a senior who could teach programming concepts in such a beautiful way! Keep going, love the content.

basharatsaigal
Автор

Great work brother, u are like the interviewbit of teaching, u have the crux of everything and complete understanding of what u r teaching!!. Hats Off..

siddhartharora
Автор

bhai agr teri videos aj se 1 month phle mil jati dp ki too life set ho jati. Very good job dude. I think tushar roy should learn something from you.

shubham
Автор

Soon your playlist will come in the top 10, best wishes. I just want you to add more videos on Algorithm :)

amitkumarsingh
Автор

Your videos helped me a lot to grasp the concept of DP . Cannot thank you enough for this precious content that you make. Keep teaching brother .

tanmaymalhotra
Автор

I just blindly followed your logic and method to convert the recursive code to tabulation version and it worked without even testing it manually. I had automated tests written to verify. Thanks for sharing your knowledge 🙏🏽

riteshpuj
Автор

after watching his videos it feels like I can achieve Nirvana 😅.
I get so much peace after understanding the concepts because he teaches so damn well!!

sleepypanda
Автор

Best channel on youtube . On my way to finish the dp playlist

teetanrobotics
Автор

To pass all corner cases, we should correct "if statement".
Runnable code:
Python code,
dp=[[0 for j in range(sum+1)]for i in range(n+1)]
for i in range(n+1):
for j in range(sum+1):
if j>0 and i==0: #corrected line j should be greater than 0, j>0.
dp[i][sum]==False
elif j==0:
dp[i][j]=True
elif arr[i-1]<=j:
dp[i][j]=dp[i-1][j] or dp[i-1][j-arr[i-1]]
else:
dp[i][j]=dp[i-1][j]
return dp[n][sum]
Thanks for Teaching, You are god for poor people.

harshavardhankanoj
Автор

This is genuinely the GOD level explanation !! Thanks Bro

mridulgoyal
Автор

So many institutes will fail to explain like this. Hats off to you

MohitKumar-sdld
Автор

Friends explanation for quick exam prep....remembering all friends who are just bright and sharp as you who would help a friend in need....Superb fell asleep even if your video is long. The power of your explanation is superb....keep it up. hope to see more from you a lot more!!!

SuperSuneel
Автор

You are awesome man! I never had imagined that I will be able to solve DP problems but I can now, all thanks to you. Keep on this amazing work :)

kajalmishra
Автор

Really very helpful . I don't know how many times I have come back to re-watch this playlist.

asthamishra
Автор

The best video ever on dp..The way you are teaching....Is just amazing

accepted