I think instead of explaining the logic from the code, u can use an example and then try to explain it would be more easy ,I know dp , but still sometimes also get confused , so pls if could improve it for all of us , that would be a great . Apart from that explanation is good.
That is for setting the first 2^n rows of the dp and choice matrix to -1 and 0 respectively. In the memset function the last parameter is the size in bytes. (1
When you are given an array or something like that and you need to store them, for example in making a subsequence we carry an arraylist which contains all the taken indexes(elements) instead of that we can have a bitmask
If you have some small length array probably less than 20 or something and you have a recursive solution where random choice is done in array at every call,i.e you have to keep track which element is chosen and which not(cases like these require traversing array inside the function for calls) then you can think for bitmask dp as you do need the array state in dp,hope this helps!
@@shashwatkrishnashukla2284 but, if i am not pre defining the minimum size of dp ( unordered_map ). So, it is giving error. Wrong answer for some test cases.
I think instead of explaining the logic from the code, u can use an example and then try to explain it would be more easy ,I know dp , but still sometimes also get confused , so pls if could improve it for all of us , that would be a great . Apart from that explanation is good.
In the memset resizing of dp and choice array why did u do +8 and +6 ?? I am not able to understand that
That is for setting the first 2^n rows of the dp and choice matrix to -1 and 0 respectively.
In the memset function the last parameter is the size in bytes. (1
@14:38 can anyone explain why did we set the size as 1
didn't got that dp initialization thing
how and what range does memset(dp, -1, 1
That choosen Array was mind blowing thought,learnt many news things thanks to You Loved it...❤❤❤❤
choice array I didn't get that, I was stuck there spent so much time but still can't, any help please
Why we are using "reserve" method or predefine the minimum size of unordered_map in bottom up approach?
Please help me out
bhaiya contest ka kab hai discussiojn?
Great explanation! thanks
How to identify that a question asks for bitmasking? I never intuitively think of that approach myself.
When you are given an array or something like that and you need to store them, for example in making a subsequence we carry an arraylist which contains all the taken indexes(elements) instead of that we can have a bitmask
If you have some small length array probably less than 20 or something and you have a recursive solution where random choice is done in array at every call,i.e you have to keep track which element is chosen and which not(cases like these require traversing array inside the function for calls) then you can think for bitmask dp as you do need the array state in dp,hope this helps!
I didn't get the use of choice array I have watched many times but still can't get it, please help
Thankyou so much sir for doing such a great job and helping us daily ❤
good explaination brother!
Why dp size [1
At 15:50 if we add 1 will it not change the value of mask , bhaiya I am new to dp and is not getting that part . Could someone pls explain me ?
he is adding +1 to ans1 not to the mask.
@@igautammunot8714 Acha okay thanks
cool explanation ❤
So many things to learn from single video damn
awesome bro
The usage of choice matrix is great
choice array I didn't get that, I was stuck there spent so much time but still can't, please help
please also do provide and show java codes
Thanks for the explanation
U r someone like whom I want to become. U r awesome. Keep it up. Soon I will overtake you.
Java ka code kahan hai?
you talk like arpit bhayani 😀
bhai tu hindi mai kr liya kr kuch samj nhi aata tera
Why we are using "reserve" method or predefine the minimum size of unordered_map in bottom up approach?
Please help me out
It is a good practice to allocate that much space to save resizing complexity
@@shashwatkrishnashukla2284 but, if i am not pre defining the minimum size of dp ( unordered_map ). So, it is giving error. Wrong answer for some test cases.