You are viewing a single comment's thread. Return to all comments →
Java (math):
public static int utopianTree(int n) { int closestOdd = n % 2 == 0 ? n + 1: n; int i = ((closestOdd-1)/2) + 2; int res = (int)Math.pow(2, i) - 2; if(n%2 == 0) { res /= 2; } return res; }
Seems like cookies are disabled on this browser, please enable them to open this website
Utopian Tree
You are viewing a single comment's thread. Return to all comments →
Java (math):