You are viewing a single comment's thread. Return to all comments →
Here is a nice c# recurcive solution...
public static int utopianTree(int n) { if(n == 0){ return 1; } if(n==1){ return 2; } if(n>1){ if(n % 2 == 0){ return utopianTree(n-1) + 1; }else{ return utopianTree(n-1)*2; } }else{ return 0; } }
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 →
Here is a nice c# recurcive solution...