-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest0108.java
More file actions
29 lines (23 loc) · 768 Bytes
/
Test0108.java
File metadata and controls
29 lines (23 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package leetcode;
import ds.tree.TreeNode;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author xiangdotzhaoAtwoqutechcommacom
* @date 2020/1/13
*/
class Test0108 {
private final Solution0108 solution = new Solution0108();
@Test
@DisplayName("108 Convert Sorted Array to Binary Search Tree")
void sortedArrayToBST() {
int[] nums = {-10, -3, 0, 5, 9};
TreeNode expected = new TreeNode(0);
expected.left = new TreeNode(-3);
expected.right = new TreeNode(9);
expected.left.left = new TreeNode(-10);
expected.right.left = new TreeNode(5);
assertEquals(expected, solution.sortedArrayToBST(nums));
}
}