File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 4
4
5
5
/**
6
6
* 222. Count Complete Tree Nodes
7
- *
8
7
* Given a complete binary tree, count the number of nodes.
9
- *
10
8
* Definition of a complete binary tree from Wikipedia:
11
9
* In a complete binary tree every level,
12
10
* except possibly the last, is completely filled,
15
13
*/
16
14
public class _222 {
17
15
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
+ */
20
20
public int countNodes (TreeNode root ) {
21
21
int leftH = getLeftHeight (root );
22
22
int rightH = getRightHeight (root );
@@ -46,12 +46,4 @@ private int getLeftHeight(TreeNode root) {
46
46
}
47
47
}
48
48
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
-
57
49
}
You can’t perform that action at this time.
0 commit comments