Sorted Array To Balanced BST

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

Balanced tree : a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

Example :


Given A : [1, 2, 3]
A height balanced BST  : 

      2
    /   \
   1     3

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
4917 successful submissions.
Asked In:
  • VMWare
  • Amazon
Click here to jump start your coding interview preparation