logo
Problems

Convert Sorted Array to Binary Search Tree With Minimal Height

Problem

Given a sorted (increasing order) array, Convert it to create a binary tree with minimal height.

Example

Given [1,2,3,4,5,6,7], return

         4
       /   \
      2     6
     / \    / \
    1   3  5   7

Note

There may exist multiple valid solutions, return any of them.

Online Judge