We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Utopian Tree
- Discussions
Utopian Tree
Utopian Tree
Sort by
recency
|
1990 Discussions
|
Please Login in order to post a comment
def utopianTree(n): h = 1 for i in range(n//2): h = h*2+1
Here is a nice c# recurcive solution...
JAVA
public static int utopianTree(int n) {
Here is my c++ solution, you can watch the explanation here : https://youtu.be/0G-kEeQC25E
Solution 1 : O(N)
Solutoin 2 : O(1)
Solutoin 3 : O(1)
Solutoin 4 : O(1)
Python solution