InterviewBit Academy is now Scaler!
Learn Tech Skills from Scratch @ Scaler EDGE

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  : 

    /   \
   1     3

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Sorted Array To Balanced BST on Interview Code Editor
Sign Up
to access hints and editorial solutions for Sorted Array To Balanced BST
Asked In:


Click here to start solving coding interview questions