Interestingly amazing problem, Thinking Logic is Easy but optimizing is Tricky 🙈, what you guys feel for this problem?? Checkout DSA-169 Series: ruclips.net/video/5BuKVS-Vnws/видео.html Problem Link: leetcode.com/problems/tallest-billboard/description/ Code & Notes: drive.google.com/file/d/1VauDLaKFieqeA1q2YLP-3hhXME8LYyor/view?usp=sharing
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]
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.
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.
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 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
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])
@@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.
Interestingly amazing problem, Thinking Logic is Easy but optimizing is Tricky 🙈, what you guys feel for this problem??
Checkout DSA-169 Series: ruclips.net/video/5BuKVS-Vnws/видео.html
Problem Link: leetcode.com/problems/tallest-billboard/description/
Code & Notes: drive.google.com/file/d/1VauDLaKFieqeA1q2YLP-3hhXME8LYyor/view?usp=sharing
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]
bro please make video everyday your explaination is very awesome and help us to learn and remember fast
we want ur explanation.......on previous 2 days problems
Wow maja aa gya bro ❤️👌
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!!!!!!
You are god brother. I used to skip hard questions but no more. You make them so easy to understand. Thanks a lot!!
god?
@@jambajuice07 lol
bro I am very weak in recursion can you tell me how to improve thinking in recursion
bhaiya i didn't get feel why you ddin't add rods[i] in opt3? btw explanation was awasome as usual🥰
Because it is guaranteed to be counted in option 2
same i am still not getting it
@@saisrikantta7648 can you explain it more
Dry run karo na bhaiya it will make helpful more.
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.
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.
Nicely explain bhai ❤
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
Striver 2.0 bro your explaination way is same as striver i really loved the way you explain
can we use meet in the middle concept to solve this ??
jab 3 states i,s1,s2 leke kar rahe the to usme rod[i] option2 me kyu nahi add kara?
Same confusion.
I watched this new channel "codestorywithMIK" and got it cleared
Great explanation bro ❤
bhaiya can you make a video on "Minimum Cost to Merge Stones"-- leetcode
Longest Arithmetic Subsequence???
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
nice explanation:)
In dp state can we do dp[i][5002-(s1+s2)]
this was like butter
Brute force was easy to get but dp part is very confusing..
sirf opt2 me add kyun kar rahe thik se nahi samajh aaya
Please reply
@ARYANMITTAL.....pls
Same confusion.
Same code is present in many places in Leetcode Discuss but none has explained this part well 😞
@@souravjoshi2293 Everyone have just pasted the code
Noone made an effort to explain how and why of the solution
Thanks for explanation. Not quite clear why rod[i] is not there in option3 :(
Because it is guaranteed to be counted in option 2
same confusion
Just use a dictionary in python to avoid the conversion stuff
Just a point : Instead of hashing we could've simply used a map.
No I guess, because map will also take the same space complexity.
Atleast in Java it is throwing a TLE.
Still not clear about adding the rod[i] in opt2 or opt3 ?
anyone please ?
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])
@@waltstone5445 bro doubt is why we are not adding the rod[i] in opt3 , like we did in opt2
You lost me at 27:16
Areh bhai tum video accha banate ho lekin bakwas bahut karte ho! Not everyone has time to watch 30+ min video
To mt dekho.
@@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.
Agree
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?
akdum shi baat hai