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

Commit8c47566

Browse files
refactor 222
1 parentcbd3a81 commit8c47566

File tree

1 file changed

+4
-12
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+4
-12
lines changed

‎src/main/java/com/fishercoder/solutions/_222.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
/**
66
* 222. Count Complete Tree Nodes
7-
*
87
* Given a complete binary tree, count the number of nodes.
9-
*
108
* Definition of a complete binary tree from Wikipedia:
119
* In a complete binary tree every level,
1210
* except possibly the last, is completely filled,
@@ -15,8 +13,10 @@
1513
*/
1614
publicclass_222 {
1715

18-
classSolutionRecursive {
19-
/**reference: https://discuss.leetcode.com/topic/21317/accepted-easy-understand-java-solution/2*/
16+
publicstaticclassSolution1 {
17+
/**
18+
* reference: https://discuss.leetcode.com/topic/21317/accepted-easy-understand-java-solution/2
19+
*/
2020
publicintcountNodes(TreeNoderoot) {
2121
intleftH =getLeftHeight(root);
2222
intrightH =getRightHeight(root);
@@ -46,12 +46,4 @@ private int getLeftHeight(TreeNode root) {
4646
}
4747
}
4848

49-
publicstaticvoidmain(String...args) {
50-
System.out.println(1 <<3);
51-
}
52-
53-
classSolutionIterative {
54-
/**TODO: implement an iterative solution*/
55-
}
56-
5749
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp