Skip to content

Commit 0bb40da

Browse files
committed
Adding readme file
1 parent 7eb3aed commit 0bb40da

File tree

1 file changed

+26
-0
lines changed
  • 108-ConvertSortedArraytoBinarySearchTree

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.
2+
3+
 
4+
Example 1:
5+
6+
Input: nums = [-10,-3,0,5,9]
7+
Output: [0,-3,9,-10,null,5]
8+
Explanation: [0,-10,5,null,-3,null,9] is also accepted:
9+
10+
11+
12+
Example 2:
13+
14+
Input: nums = [1,3]
15+
Output: [3,1]
16+
Explanation: [1,null,3] and [3,1] are both height-balanced BSTs.
17+
18+
19+
 
20+
Constraints:
21+
22+
23+
1 <= nums.length <= 104
24+
-104 <= nums[i] <= 104
25+
nums is sorted in a strictly increasing order.
26+

0 commit comments

Comments
 (0)