Practice Convert Sorted List to Binary Search Tree
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#109
LeetCode ProblemConvert Sorted List to Binary Search Tree
Problem Statement
Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced binary search tree.
Source: Convert Sorted List to Binary Search Tree on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
head = [-10,-3,0,5,9]
Output
[0,-3,9,-10,null,5]
# Example 2
Input
head = []
Output
[]
Constraints
The number of nodes in head is in the range [0, 2 * 10^4].
-10^5 <= Node.val <= 10^5
Related LeetCode Problems
Practice more problems similar to Convert Sorted List to Binary Search Tree.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.