Search⌘ K
AI Features

Solution: Convert Sorted List to Binary Search Tree

Let's solve the Convert Sorted List to Binary Search Tree problem using the Tree Depth-First Search pattern.

Statement

Given the head of a singly linked list whose elements are arranged in ascending order, convert it into a height-balanced binary search tree and return the root of the resulting tree.

A height-balanced binary search tree is one where the depth of the two subtrees of every node never differs by more than 11.

Constraints:

  • 00 \leq number of ...