How did you think of this? Was it by drawing a recursive tree or you learnt and then implemented or you could come up with this approach?
@dsatechsimplified3 ай бұрын
I practiced quite a lot of questions, which helped me solve this one. But I must say that the recursive tree helped me solve it quite quickly.
@Virtualexist3 ай бұрын
@@dsatechsimplified Thank you for sharing the insights. Helpful!
@Virtualexist3 ай бұрын
I envy your handwriting haha! Good explanation.
@dsatechsimplified3 ай бұрын
Thanks , Maybe I should start giving handwriting classes. First lesson - How to make your pen do all your work . Haha!
@Virtualexist3 ай бұрын
@@dsatechsimplified 😂😂😂 Perfect!
@chillkro259 ай бұрын
Great explanation ❤
@dsatechsimplified9 ай бұрын
Thankyou
@vinamrasangal84368 ай бұрын
Great explanation
@dsatechsimplified8 ай бұрын
Glad it was helpful!
@Virtualexist3 ай бұрын
Hamne ans vector ko locally kyu lia? Why did we not pass it by reference or keep it global?
@dsatechsimplified3 ай бұрын
Because in this problem we are considering every subtree as a separate tree which brings a result . That's why we use local ans vector. Try to dry run the code and focus more on understanding the recursive tree behavior.
@Virtualexist3 ай бұрын
@@dsatechsimplified Yess, I am trying to understand. I got confused that how is the local copy of each function call preserved, then I saw it is being returned after each call. So it gets saved in the left or right whichever is the parent function call originating from.
@Virtualexist3 ай бұрын
@@dsatechsimplified Thanks a lot for prompt responses! 😇🙏🏼 Best wishes to you for your growth!
@dsatechsimplified3 ай бұрын
thankyou so much
@shay25594 ай бұрын
bravo
@RahulRaj-bw2hc2 ай бұрын
After apply Dp your code perform worst than the recursion. Earlier it was 8 ms beat 48% user but After apply Dp it reduce to 18ms and 5% Beat the solution. You are not assign value to Dp, you are only using the value to find the is it present in the Dp or not.
@arpit98952 ай бұрын
yess broiiii
@dsatechsimplified2 ай бұрын
You can optimise your code accordingly. Actually my idea for creating this video is to explain how can you approach this question. Once you are able to solve it by your own you can easily optimize your code.
@shashankshekhar8186 Жыл бұрын
Content is very good but the background noise sucks