Good Explanation. Building the intuition is the main task while learning Problem Solving which people leave. It sometimes even helps in other unsolved questions we encounter. Thanks for making this an integral part of your videos.
Instead of storing the numbers, we can use index of element picked from second array as second parameter and -1 for not picking the element, dp[index][par2+1]
Yup that's what I thought too. This can be much better especially for languages where the HashMap is significantly more expensive than a normal array, like in Rust.
it will not work, as we are replacing the value from arr2, how will you know you have replaced the value from arr2 and not taken the arr1 prev value, in the next call stack, so he is taking the actual value itself.
just one suggestion instead of explaining direct dp solution, first explain the recursive solution and then move to dp optimized solution so it will become more easy and simple to understand
Thanks for the awesome explanation. However, I have a small question regarding the TC. The TC mentioned in the video is n*m*logm. Basically n*m means, we are pairing every number of arr1 with every number of arr2. But that is not the case. For each index of arr1, we are simply searching the ceil num from arr2. Shouldn't the TC be N*logM. Am I missing something here. Please Help!!
I just sometimes open your vedio thinking that this will be better than previous , but you are not a good teacher i think so , may be if you do some less overacting and give more effort on explaining the solution ,it may work it's seem like you are explaining it to yourself .