package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/utopian-tree
 */
public class UtopianTree {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // TODO
    }
}

@@ -139,108 +139,534 @@
    p
-ublic static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        // TODO
+rivate static int utopianTree(int n) %7B%0A        int height = 1;%0A        for (int i = 0; i %3C n; i++) %7B%0A            if (i %25 2 == 0) %7B%0A                height *= 2;%0A            %7D else %7B%0A                height++;%0A            %7D%0A        %7D%0A        return height;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int testCases = in.nextInt();%0A        for (int t = 0; t %3C testCases; t++) %7B%0A            int n = in.nextInt();%0A            System.out.println(utopianTree(n));%0A        %7D
 %0A   

Solve Utopian Tree