Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Count Complete Tree Nodes
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given a complete binary tree, count the number of nodes.
Sample Input:
[1,2,3,4,5,6]
Sample Output:
6
Hints
Hint 1
Use binary search on tree height
Hint 2
Check if subtree at middle index exists
Hint 3
O(log n * log n) time complexity
Code Editor
Reset
Run
Save
Loading...