Convert Sorted List to Binary Search Tree

Medium · Binary Search Trees · about 20 minutes

Asked at Meta, Amazon, Microsoft, Google.

The linked list holds values in ascending order. Build from them a binary search tree in which, at every node, the heights of the left and right subtrees differ by no more than one, and return its root.

Related guides