Tallest Billboard II DP II Reducing DP States II Hashing II 0/1 Knapsack II Leetcode 956
In this video, I'll talk about how to solve the problem Leetcode 956. Tallest Billboard II DP II Reducing DP States II Hashing II 0/1 Knapsack
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
Problem Link: leetcode.com/problems/tallest...
Code & Notes: drive.google.com/file/d/1VauD...
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / aryan_mittal_007
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
🛍️ Products I use in Videos: (✨ Marked for Mostly requested Products)
Main Camera (Canon 200D ii): amzn.to/41cfS5h
Vlog Camera (iphone 13): amzn.to/42aOJRh
Tripod for Lectures: amzn.to/3HMoloF
Tripod for Vlogs: amzn.to/44wGL6L
✨Mic: amzn.to/41bj8gU
Shadow Multi Colour Light: amzn.to/41bmIrq
Main Light: amzn.to/3LF6BNb
Tripod for Lights: amzn.to/3LFcQAt
Softbox for Lights: amzn.to/42mHqWE
✨My Pen Tablet for Notes: amzn.to/44A61ZJ
✨New Tablet for Notes: amzn.to/44BjTDa
Tablet Stand: amzn.to/3NMFIJR
Power Bank: amzn.to/421yHsZ
✨USB Hub: amzn.to/3p8NGTf
✨HardDisk to store Lectures: amzn.to/3HKafEs
✨My Laptop: amzn.to/44w12ct
✨My Monitor: amzn.to/3LCG6YL
My UPS: amzn.to/3Lydy2y
My UPS old: amzn.to/3LXT0C3
✨My Mouse: amzn.to/3LYmJdY
✨My Keyboard: amzn.to/3NJs4ah
Resources you can try:
Learn Coding: • Complete RoadMap for C...
🎥Channel Playlists
🎥 Baap Graph Series - by Aryan: • Baap Graph Series - by...
🎥Dynamic Programming: • Complete Dynamic Progr...
🎥Bit Manipulation: • Complete BIT MANIPULAT...
🎥Mathematics for DSA: • Complete Mathematics f...
🎥Leetcode Top Interview Questions: • FAANG & Leetcode Inter...
🎥Codeforces Problem B Ladder: • Complete PROBLEM B LAD...
🎥Codeforces Problem C Ladder: • Codeforces PROBLEM C L...
🎥Codeforces Problem D Ladder: • Complete PROBLEM D LAD...
🎥 Top 150 Interview Questions: • Top 150 Interview Ques...
🎥 Complete Array Problem Playlist: • Complete Array Intuit...
🎥 Complete Binary Search Problem Playlist: • Complete Binary Search...
🎥 Complete Stack Playlist: • Complete Stack & Queue...
🎥 Complete Graph Problem Playlist: • Complete Graph Intuiti...
🎥 Complete TREE Playlist: • Complete TREE Intuitio...
🎥 Complete DP Problem Solving: • Complete DP Intuition ...
🎥 Complete Linked List: • Complete Linked List I...
🎥 Complete Greedy Problem Playlist: • Complete Greedy Intui...
🎥 Complete Divide & Conquer Algorithm Playlist: • Complete Divide & Conq...
🎥 Complete Trie Playlist: • Complete Trie Intuitio...
🎥 Complete Mathematics & Number Theory Problems: • Complete Mathematics &...
About Channel:
We teach about how you can grow in life & educate about programming in Fun & Intuitional way.
About Me:
I am Aryan Mittal - a Software Engineer, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - Bakwas
0:35 - Problem Explanation
3:00 - Intuition Building from Example
5:41 - How Intuition will work
8:25 - Summing Up and Getting ready to Code :)
11:30 - First Intuition Recursion
16:00 - Complexity
17:20 - Optimization
19:50 - Hashing Logic
22:00 - Optimized Code Explanation
30:50 - Complexity Analysis
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Пікірлер: 58
Interestingly amazing problem, Thinking Logic is Easy but optimizing is Tricky 🙈, what you guys feel for this problem?? Checkout DSA-169 Series: kzread.info/dash/bejne/Z3aprbiMXbnUp9Y.html Problem Link: leetcode.com/problems/tallest-billboard/description/ Code & Notes: drive.google.com/file/d/1VauDLaKFieqeA1q2YLP-3hhXME8LYyor/view?usp=sharing
@sagarkasana144
Жыл бұрын
bhaiya i was using unordered_map of string ,it gives me tle then ☹☹
Another way to understand why we added rows[I] to opt2 only---> let us consider the function to be returning the max value of s1 (since s1 and s2 are the same) op1 tells us the max height of s1 if we do not take the curr rod . Hence the height contribution (on s1) will be 0 and diff will remain same op2 tell us the max height of s1 if we add the rod to s1. Hence the height contribution (on s1) will be rods[I] and diff will increase by rods[I] op3 tells us the max height of s1 if we add the rod to s2. Hence the height contribution (on s1) will be 0 and the diff will decrease by rods[I]
we want ur explanation.......on previous 2 days problems
bro please make video everyday your explaination is very awesome and help us to learn and remember fast
Please create a video of yesterday's problem. It was also a good one.
Bro please also solve yesterday' problem,ab toh tumhara video dekhkar hi clear hota hai
nobody except you can make this problem feel so easy, maybe i will be able to code it by myself now ...
Hey brother just saw your old videos!!, your transformation is insaneeee!!!!!!
Wow maja aa gya bro ❤️👌
Great explanation bro ❤
You are god brother. I used to skip hard questions but no more. You make them so easy to understand. Thanks a lot!!
for me this question seems so easy in beginning, in just 5 minuts I did the recurtion solution, then did dp,but because it is a 3d dp solution it showed memory limit exited
bro I am very weak in recursion can you tell me how to improve thinking in recursion
Nicely explain bhai ❤
nice explanation:)
Striver 2.0 bro your explaination way is same as striver i really loved the way you explain
Mate when you explain it all seems so intuitive and easy, but when I go to code it myself, especially thinking out the DP architecture, I can't understand it. And in this problem I still have a little doubt about why we are adding rods[i] only once in the optimised solution.
@amankumartiwari1502
Жыл бұрын
we are adding once when we add it will increase the difference like it get added in rod1 and now our difference is 0+rod[i] now in next time we don't need to add because if support 2 get added the same number then we should decrease that difference so it will become 0 we are not dealing with rods we are dealing with difference that's why we when adding it we are increasing the difference or else adding in 2nd support we just decreasing the difference and that starting rod so we can get only one rod length that we need to return that's all.
Dry run karo na bhaiya it will make helpful more.
can we use meet in the middle concept to solve this ??
bhaiya i didn't get feel why you ddin't add rods[i] in opt3? btw explanation was awasome as usual🥰
@saisrikantta7648
Жыл бұрын
Because it is guaranteed to be counted in option 2
@083_h_nitishkumarjha3
Жыл бұрын
same i am still not getting it
@083_h_nitishkumarjha3
Жыл бұрын
@@saisrikantta7648 can you explain it more
this was like butter
In dp state can we do dp[i][5002-(s1+s2)]
Longest Arithmetic Subsequence???
Brute force was easy to get but dp part is very confusing..
bhaiya can you make a video on "Minimum Cost to Merge Stones"-- leetcode
Still not clear about adding the rod[i] in opt2 or opt3 ? anyone please ?
@waltstone5445
Жыл бұрын
See for adding the rod in opt 2 We know diff = S1 + S2 right, if we were to choose option 2 i.e adding length to S1 then diff = S1+rod[i] -s2 = S1-S2 +rod[i]>>> Similarly for options 3 we add length to S2 so diff = s1-(S2+rod [i])
@083_h_nitishkumarjha3
Жыл бұрын
@@waltstone5445 bro doubt is why we are not adding the rod[i] in opt3 , like we did in opt2
Just use a dictionary in python to avoid the conversion stuff
bro one suggestion , speak slower not get too excited , so that you'll be able to put words properly and listening experience also enhances ......btw nice explanation
Just a point : Instead of hashing we could've simply used a map.
@rhymes1717
Жыл бұрын
No I guess, because map will also take the same space complexity. Atleast in Java it is throwing a TLE.
jab 3 states i,s1,s2 leke kar rahe the to usme rod[i] option2 me kyu nahi add kara?
@souravjoshi2293
Жыл бұрын
Same confusion. I watched this new channel "codestorywithMIK" and got it cleared
Thanks for explanation. Not quite clear why rod[i] is not there in option3 :(
@saisrikantta7648
Жыл бұрын
Because it is guaranteed to be counted in option 2
@souravjoshi2293
Жыл бұрын
same confusion
You lost me at 27:16
sirf opt2 me add kyun kar rahe thik se nahi samajh aaya Please reply
@lover_of_u3455
Жыл бұрын
@ARYANMITTAL.....pls
@souravjoshi2293
Жыл бұрын
Same confusion. Same code is present in many places in Leetcode Discuss but none has explained this part well 😞
@mayur_madhwani03
Жыл бұрын
@@souravjoshi2293 Everyone have just pasted the code Noone made an effort to explain how and why of the solution
Areh bhai tum video accha banate ho lekin bakwas bahut karte ho! Not everyone has time to watch 30+ min video
@ishitakumari3766
Жыл бұрын
To mt dekho.
@peachpink2831
Жыл бұрын
@@gautamsharma69but Aryan here is providing free help no? if you don't want it then watch somebody else. Who has the time and effort to edit and post daily within hours of the question plus other daily task? Maybe learn to skip to the time stamp of the content you need or look for more sources yourself ¯\_(ツ)_/¯ There’s plenty of solutions in the designated tab on the question anyways.
@ankitkunwar2
Жыл бұрын
Agree
@Yogesh-lv5xv
Жыл бұрын
Sala haatho ko jyada fekta hai hawa mein . @ARYANMITTAL
bhai thda smjhane wali acting km ho to...jyada acha lagega..sasta striver😂
Hindi bol lia kar bhai, teri english smajh nhi aati. Getting my point?
@divyanshuagarwal1912
Жыл бұрын
akdum shi baat hai