Thank you this was really helpful. I thought of this but had no clue how to find the number of nodes of the last level without iterating over the last level and adding its count to the total nodes (minus the last level)
Thank you! I was going to say that the space would be O(log N) because of the potential maximum size of the call stack. However, I'm reviewing the solution now and in fact I don't think we're ever putting the `nodeExists` function onto the call stack once. So yes, you're right. Thank you very much! I'll update the description now :)
Thank you this was really helpful. I thought of this but had no clue how to find the number of nodes of the last level without iterating over the last level and adding its count to the total nodes (minus the last level)
It’s a tricky one for sure!
there are a lot of poor explanations for this problem in yt, your's was the best ! .. keep up the good work
Subscribed as well
Love to hear it! Tysm!!
Great explanation, thank you!
omg your fast, are you drawing with the mouse too?
not with the mouse! I dropped about 35 smackeroons on a real simple pen & pad that connects to the laptop
Why is space O(log N)? should it be O(1) instead? Also awesome explanation thank you!!
Thank you! I was going to say that the space would be O(log N) because of the potential maximum size of the call stack. However, I'm reviewing the solution now and in fact I don't think we're ever putting the `nodeExists` function onto the call stack once. So yes, you're right. Thank you very much! I'll update the description now :)