Bro please make video on Question Number 110. Balanced Binary Tree.and your Teaching technique is so good. Please make video urjently because my Amazon interview schedule in next week
I don't think I understand how the tree works. In the first test case the trees are q = [1, 2, 3] and p = [1, 2, 3] and if I write: return q.val == p.val and q.left == p.left and q.right == p.right, the output is False??? Also if I try just return q (for science), I would expect the output to be the tree [1,2,3], but instead the output is True?? What the fuck. How do these damn trees work?!?
Can you do a tutorial on the recusive solution? figiured out the itreative solution but I am still a little bit confused on how the recusive solution works.
if you understand the iterative solution, that is all you need. A recursive solution if often confusing. If you still want a recursive solution, you might find one in the leetcode discuss section. I would not recommend it though
i usually prefer an iterative approach, as it is more easy to debug. Think about a scenario when you are trying to understand the flow and find what is going wrong. With a recursive approach, you will get stuck in cycles, and it gets very hard. At the end it comes down to preference.
@@Amed-pf7dp The space complexity of this solution is O(n) in the worst case, as the recursive calls will use space on the call stack proportional to the height of the tree