Challenge: Create a Binary Search Tree From the Sorted List

Let’s create a binary search tree from a sorted list.

Problem

Create a binary search tree from a list of values in sorted order.

Input

An array of integers.

Output

A binary search tree.

Sample input

array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Sample output

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.