Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd52268

Browse files
add a test for 270
1 parentd185eca commitdd52268

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
packagecom.fishercoder;
2+
3+
importcom.fishercoder.common.classes.TreeNode;
4+
importcom.fishercoder.common.utils.TreeUtils;
5+
importcom.fishercoder.solutions._270;
6+
importorg.junit.BeforeClass;
7+
importorg.junit.Test;
8+
9+
importjava.util.Arrays;
10+
11+
importstaticjunit.framework.Assert.assertEquals;
12+
13+
publicclass_270Test {
14+
privatestatic_270.Solution1solution1;
15+
privatestaticintexpected;
16+
privatestaticTreeNoderoot;
17+
privatestaticdoubletarget;
18+
19+
@BeforeClass
20+
publicstaticvoidsetup() {
21+
solution1 =new_270.Solution1();
22+
}
23+
24+
@Test
25+
publicvoidtest1() {
26+
root =TreeUtils.constructBinaryTree(Arrays.asList(4,2,5,1,3));
27+
expected =4;
28+
target =3.714286;
29+
assertEquals(expected,solution1.closestValue(root,target));
30+
}
31+
32+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp