Number of Dice Rolls with Target Sum - Leetcode 1155 - Python

  Рет қаралды 16,623

NeetCodeIO

NeetCodeIO

Күн бұрын

🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑‍💼 LinkedIn: / navdeep-singh-3aaa14161
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
Problem Link: leetcode.com/problems/number-...
0:00 - Read the problem
0:30 - Explaining Memoization solution
6:14 - Coding Memoization solution
10:01 - Explaining DP solution
15:17 - Coding DP solution
leetcode 1155
#neetcode #leetcode #python

Пікірлер: 36
@massimomonticelli6010
@massimomonticelli6010 6 ай бұрын
A small improvement for the first solution (memoization) is to include a base case that stops recursion if the target becomes negative.
@YashRekha594
@YashRekha594 6 ай бұрын
I'm done for today. New year resolution would be to learn dynamic programming 😅
@MP-ny3ep
@MP-ny3ep 6 ай бұрын
Merry Christmas Neetcode !
@jayberry6557
@jayberry6557 6 ай бұрын
Giving 5 easies in row just to hit u with DP problem on Christmas day 😂😂 Someone had a bad day
@KnightMirkoYo
@KnightMirkoYo 6 ай бұрын
Well, problems through the entire December until 25th were really easy (even those marked as medium), and then they hit us with 2 DP in a row 😅
@RSWDev
@RSWDev 6 ай бұрын
Merry Christmas!
@dimplepandya9522
@dimplepandya9522 6 ай бұрын
merry Christmas!
@harshithdesai9989
@harshithdesai9989 6 ай бұрын
Hello people. I have a hard time visualizing the backtracking tree and providing the Dynamic Programming optimization for it. Can anyone help me to get better at this and also to get better at solving DP problems.... 🙂
@caiodavi9829
@caiodavi9829 6 ай бұрын
try cses dp section
@harshithdesai9989
@harshithdesai9989 6 ай бұрын
@@caiodavi9829 cses?
@m.kamalali
@m.kamalali 6 ай бұрын
hey neetcode , i think we can rid off next_dp array if we build the solution up-bottom mod=10**9+7 dp=[0]*target+[1] for i in range(n-1,-1,-1): for s in range(target+1): dp[s]=0 for j in range(1,k+1): if s+j>target:break dp[s]=(dp[s]+dp[s+j])%mod return dp[0]
@onlinealias622
@onlinealias622 6 ай бұрын
I got the memoization solution myself but the bottom up tabulation solutions are tricky :/
@satwiktatikonda764
@satwiktatikonda764 6 ай бұрын
wonderful solution but if you go memoization ->tabulation ->tabulation(space optimized) it would be helpful for beginners to learn all 3 variations
@two697
@two697 6 ай бұрын
Thf he's done a bunch of problems almost identical to this where he's done it in that order. There's no need to go through it again every time.
@satwiktatikonda764
@satwiktatikonda764 6 ай бұрын
@@two697 you may be skilled enough and you may dnt need it I am talking from a beginner perspective
@NeetCodeIO
@NeetCodeIO 6 ай бұрын
The main reason I don't always do this is because it results in a very long video, which most people won't watch.
@omarr993
@omarr993 6 ай бұрын
most people won't watch and also most companies wouldn't even expect you to come up with tabulation(space optimized) method during an interview, only small % of people would probably be capable of doing that on the spot and they usually go through other resources to learn that niche stuff
@coolgamertm4411
@coolgamertm4411 6 ай бұрын
@@NeetCodeIO true i would say
@boehan605
@boehan605 6 ай бұрын
i wish i was as good as you 😭
@lavanyam3224
@lavanyam3224 3 ай бұрын
The thumbnails of your previous videos were better with Company logos.. please continue putting company logos in the thumbnail as it is easy to pick company specific questions xD
@kostiantynivanov6875
@kostiantynivanov6875 6 ай бұрын
Is that a medium complexity problem for real? You need to be a real smart ass to figure that out. As for me, it's not about programming in general - it's more about having uni education to be able to build such math yourself. I'm also curious how much time did it take for you to solve this problem?
@ruzibayevich1693
@ruzibayevich1693 6 ай бұрын
why don't you publish the solution on leetcode ?
@gmbabar
@gmbabar 6 ай бұрын
Why we take mod as 10**9 + 7?
@caiodavi9829
@caiodavi9829 6 ай бұрын
because its a prime number
@prashanthkurella4500
@prashanthkurella4500 6 ай бұрын
Why do we need the mod
@bundiderp5109
@bundiderp5109 6 ай бұрын
To not overflow the number we are tracking.
@ChrisBakare
@ChrisBakare 6 ай бұрын
Another problem down the drain for me. I barely understood your solution (not your fault). I need to study DP and backtracking. You would think a degree would prepare you for that.
@ej6431
@ej6431 6 ай бұрын
same boat, don't stress too much we got this
@coolkaw4497
@coolkaw4497 6 ай бұрын
I was completely lost with DP until I watched videos such as Tech with Nikola and his Mastering Dynamic Programming videos. In addition, I would suggest doing easier DP problems as well such as House Robber. While I couldn’t come up with a solution for this problem, I can at least understand the solutions! Good luck, let’s all work for a better future
@ej6431
@ej6431 6 ай бұрын
thank you sir@@coolkaw4497
@prakhar4585
@prakhar4585 6 ай бұрын
I think I am too young for this concept 😅🤣
@coolkaw4497
@coolkaw4497 6 ай бұрын
Never too young to learn programming ! Be ahead of the game !
@Bfhehdhhx
@Bfhehdhhx 6 ай бұрын
merry Christmas!
@YansongLi
@YansongLi 6 ай бұрын
Merry Christmas!
Permutations - Leetcode 46 - Python
11:58
NeetCodeIO
Рет қаралды 6 М.
Coin Change - Dynamic Programming Bottom Up - Leetcode 322
19:23
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,9 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 29 МЛН
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 49 МЛН
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 35 МЛН
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 559 М.
Implement Queue using Stacks - Leetcode 232 - Python
15:23
NeetCodeIO
Рет қаралды 21 М.
Leetcode #200 - Number of Islands - Python
13:04
UcheCodez
Рет қаралды 76
Continuous Subarray Sum - Leetcode 523 - Python
14:56
NeetCode
Рет қаралды 63 М.
Maximum Profit in Job Scheduling - Leetcode 1235 - Python
14:45
NeetCodeIO
Рет қаралды 28 М.
Path Crossing - Leetcode 1496 - Python
7:31
NeetCodeIO
Рет қаралды 12 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 309 М.
Furthest Building You Can Reach - Leetcode 1642 - Python
11:08
NeetCodeIO
Рет қаралды 14 М.
Be a Python Pro with Enumerate
0:55
Rob Mulla
Рет қаралды 1 МЛН
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,9 МЛН