Hey Neetcode, Whenever you get some free time can you please solve the problem - Number of Wonderful Substrings. I haven't been able to find a single good video explaining the intuition of how to solve such problems. Thank you in advance! 😃
You didn't really need a hashmap even if using it doesn't hurt performance much I suppose, I avoided it doing the following: Whenever I encounter a leaf node, I pop again, if what I just popped isn't leaf, I add the previous leaf and and then add the non leaf, if both nodes are leaf, I pop the operator again and evaluate both of them and append the result. If this wasn't a tree and was some sort of a graph then yes a hashmap would be useful to not evaluate a node multiple times( number of times it's referenced)
My friend, I want to examine your brain. After so many leetcode questions, I think you have an extremely superior brain.
Thanks for keep posting the solutions of the daily challenges! It's helping me a lot this past few days!
Shoutout to laddoo gang.
Video was helpful as ever, thank you neetcode for the neat code.
Hey Neetcode, Whenever you get some free time can you please solve the problem - Number of Wonderful Substrings. I haven't been able to find a single good video explaining the intuition of how to solve such problems. Thank you in advance! 😃
Never this early, hello neetcode 😊🎉
I think the recursive solution is O(log n) as it's a full binary tree
You didn't really need a hashmap even if using it doesn't hurt performance much I suppose, I avoided it doing the following:
Whenever I encounter a leaf node, I pop again, if what I just popped isn't leaf, I add the previous leaf and and then add the non leaf, if both nodes are leaf, I pop the operator again and evaluate both of them and append the result. If this wasn't a tree and was some sort of a graph then yes a hashmap would be useful to not evaluate a node multiple times( number of times it's referenced)
I solved it iteratively using 2 stacks for simplicity
The iterative approach is medium if not quite hard
Which laddoo do you like bro?
the iterative solution is just as efficient as the recursive one right ?
yeah thats right
2055. Plates Between Candles... Next Please..
LADDOO REFERENCE AGAIN!
🥹🟠
Ladooo 😂