Skip to content

Commit 8c47566

Browse files
refactor 222
1 parent cbd3a81 commit 8c47566

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
public class _222 {
1715

18-
class SolutionRecursive {
19-
/**reference: https://discuss.leetcode.com/topic/21317/accepted-easy-understand-java-solution/2*/
16+
public static class Solution1 {
17+
/**
18+
* reference: https://discuss.leetcode.com/topic/21317/accepted-easy-understand-java-solution/2
19+
*/
2020
public int countNodes(TreeNode root) {
2121
int leftH = getLeftHeight(root);
2222
int rightH = getRightHeight(root);
@@ -46,12 +46,4 @@ private int getLeftHeight(TreeNode root) {
4646
}
4747
}
4848

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

0 commit comments

Comments
 (0)