If we have any doubts on dp problem on Intuition or understanding, do watch this playlist for practice - ua-cam.com/play/PLEL7R4Pm6EmCXe8803IBAPWVsHlTVrtOp.html . . How all Educators are lying to you - ua-cam.com/video/PGqOJlv0VeY/v-deo.html
@ARYANMITTAL great video brother. Just a single doubt, in this we are using the prefix concept some people have used a different prefix space to store the prefixes but you made the specific dp state itself as the prefix value by adding it's previous state into it, but when giving the final answer you are returning the dp state itself which is a prefix of dp states till that point, shouldn't you subtract the previous state from it so it isn't the prefix state anymore and then return it? Also, i am saying convert it into prefix because in the non-optimal tabulation method you are only adding the alternate 0 or 1 state to add into current state but in the optimal one at the start only you are adding the same 0 or 1 previous state into it which makes it the prefix state till then.
Did you get the answer to "when giving the final answer you are returning the dp state itself which is a prefix of dp states till that point, shouldn't you subtract the previous state from it so it isn't the prefix state anymore and then return it?" I also have the same doubt.
Hi @ARYANMITTAL thanks for the solution, I am facing an issue that when i make dp of type dp[zero][one][consecutiveEl][cnt], my solution gets sumitted but when i use dp of type dp[zero][one][cnt][consecutiveEl] it gives tle. Is this some kind of glitch of leetcode as the time complexity of both the type is same. I am very confused.
simply bcz we are counting from limit to z-1. for ex - let's say limit is 1 so if we do dp[z - limit][o][1] this means dp[z -1][o][1] but since our limit is 1 that means we have consider 1 previous element then we should do dp[z -2][o][1] instead of dp[z -1][o][1] this is why dp[z - limit - 1][o][1]
Bhai normally explain nahi kar sakta kya? It annoying at times the over exaggeration. Aur tune hi ye problem ka video dala hai so got no option. Anyways good content
Great video sir . It's really awesome to see alumni sharing their expertise.
58 mins is worthy to watch it.
The video for which we were waiting. Thanks @aryan
If we have any doubts on dp problem on Intuition or understanding, do watch this playlist for practice - ua-cam.com/play/PLEL7R4Pm6EmCXe8803IBAPWVsHlTVrtOp.html
.
.
How all Educators are lying to you - ua-cam.com/video/PGqOJlv0VeY/v-deo.html
Pin this comment
sab samjh aa gya, accha solution tha.
bhai awesome explaination
amazing video
great explanation
How can this question be done in 1 hr 😶😶😶.... HOw to get intution... then optimize... then solve to in just 1hr.. how??
I am not an english expert but improvisation means making something on the spot and improvement means to improve something. Both are not the same.
On which writing pad do you write?
dont ever stop bro
the optimization from o(n^3) to O(n^2) was difficult to understand
@ARYANMITTAL great video brother. Just a single doubt, in this we are using the prefix concept some people have used a different prefix space to store the prefixes but you made the specific dp state itself as the prefix value by adding it's previous state into it, but when giving the final answer you are returning the dp state itself which is a prefix of dp states till that point, shouldn't you subtract the previous state from it so it isn't the prefix state anymore and then return it?
Also, i am saying convert it into prefix because in the non-optimal tabulation method you are only adding the alternate 0 or 1 state to add into current state but in the optimal one at the start only you are adding the same 0 or 1 previous state into it which makes it the prefix state till then.
Did you get the answer to "when giving the final answer you are returning the dp state itself which is a prefix of dp states till that point, shouldn't you subtract the previous state from it so it isn't the prefix state anymore and then return it?"
I also have the same doubt.
Hi @ARYANMITTAL thanks for the solution, I am facing an issue that when i make dp of type dp[zero][one][consecutiveEl][cnt], my solution gets sumitted but when i use dp of type dp[zero][one][cnt][consecutiveEl] it gives tle. Is this some kind of glitch of leetcode as the time complexity of both the type is same. I am very confused.
if you are using python it will give
@@akashkaruturi5128 I have written my code in c++.
same problem here with c++
@@akashkaruturi5128 I have written my code in c++
Yes I also faced same issue in the contest
why not dp[z - limit][o][1] instead of dp[z - limit - 1][o][1]? Still not able to grasp it
simply bcz we are counting from limit to z-1.
for ex - let's say limit is 1 so if we do dp[z - limit][o][1] this means dp[z -1][o][1] but since our limit is 1 that means we have consider 1 previous element then we should do dp[z -2][o][1] instead of dp[z -1][o][1]
this is why dp[z - limit - 1][o][1]
Bhai normally explain nahi kar sakta kya? It annoying at times the over exaggeration. Aur tune hi ye problem ka video dala hai so got no option. Anyways good content
this code is not getting pass with java
Giving TLE for last 2 test case