LeetCode 108. Convert Sorted Array to Binary Search Tree - Interview Prep Ep 71

preview_player
Показать описание


⭐ Support my channel and connect with me:

Solutions explained:
We'll find the middle node in the sorted array to form the current root node, and then keep doing so recursively to build its left and right subtrees.

Time complexity: O(n)
Space complexity: O(n)

// TOOLS THAT I USE:

// MY FAVORITE BOOKS:

My ENTIRE Programming Equipment and Computer Science Bookshelf:

And make sure you subscribe to my channel!

Your comments/thoughts/questions/advice will be greatly appreciated!

#softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures
Рекомендации по теме
Комментарии
Автор

Best Ever explanation. Please add more Medium and Hard Problems from leetcode. Thanks for the effort and hard work.

ChandraShekhar-bycd
Автор

Fisher you are the best. Thanks for your video!

yxs
Автор

Great explanation. Subscribed. By the way How do you see Messenger and whatapp on the sidebar? Is it extension?

raymondc
Автор

Here start+end/2 may overflow better would be to use start + (end-start)/2

ChandraShekhar-bycd
Автор

Would this problem have an iterative counterpart? The recursive version seems quite obvious to me but I'm not sure how I would take advantage of a stack/queue to do this iteratively.

ryancodrai
Автор

Didn’t understood, what is the need of base condition and how it works? Mean to say end is always gonna be greater than start which is always 0

nishargshah