Skip to content

Commit

Permalink
Update 222.Count-Complete-Tree-Nodes_v2.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Nov 9, 2019
1 parent 0cec913 commit 282afbe
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ class Solution {
public:
int countNodes(TreeNode* root)
{
if (root==NULL) return 0;
int h = 0;
TreeNode* node = root;
while (node!=NULL)
{
h++;
node = node->left;
}
int low = 1;
int low = (1<<(h-1));
int hi = (1<<h)-1;

while (low<hi)
Expand Down

0 comments on commit 282afbe

Please sign in to comment.