-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest0112.java
33 lines (27 loc) · 874 Bytes
/
Test0112.java
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
30
31
32
33
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.assertTrue;
/**
* @author xiangdotzhaoAtwoqutechcommacom
* @date 2019/12/20
*/
class Test0112 {
private final Solution0112 solution = new Solution0112();
@Test
@DisplayName("112 Path Sum")
void hasPathSum() {
TreeNode root = new TreeNode(5);
root.left = new TreeNode(4);
root.right = new TreeNode(8);
root.left.left = new TreeNode(11);
root.left.left.left = new TreeNode(7);
root.left.left.right = new TreeNode(2);
root.right.left = new TreeNode(13);
root.right.right = new TreeNode(4);
root.right.right.right = new TreeNode(1);
int sum = 22;
assertTrue(solution.hasPathSum(root, sum));
}
}