• + 0 comments
        public static int utopianTree(int n)
        {
            var height = 1;
           for(int i = 0; i < n; i++) {
               if(i % 2 == 0) {
                   height *= 2;
               } else {
                   height += 1;
               }
           } 
           
           return height;
        }