0109. Convert Sorted List to Binary Search Tree

https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree

Description

Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

For this problem, 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 1:

Example 2:

Example 3:

Example 4:

Constraints:

  • The number of nodes in head is in the range [0, 2 * 104].

  • -105 <= Node.val <= 105

ac

Last updated

Was this helpful?