package leetcode;

public class Problem1688 {
    public int numberOfMatches(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1688 prob = new Problem1688();
        System.out.println(prob.numberOfMatches(7)); // 6
        System.out.println(prob.numberOfMatches(14)); // 13
    }
}

@@ -91,249 +91,349 @@
     
-// TODO%0A        return 0
+int answer = 0;%0A        int winner = n
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1688 prob = new Problem1688();%0A        System.out.println(prob.numberOfMatches(7)); // 6%0A        System.out.println(prob.numberOfMatches(14)); // 13
+while (winner %3E= 2) %7B%0A            int matches;%0A            if (winner %25 2 == 0) %7B%0A                matches = winner / 2;%0A            %7D else %7B%0A                matches = (winner - 1) / 2;%0A            %7D%0A            winner -= matches;%0A            answer += matches;%0A        %7D%0A        return answer;
 %0A   

Solve problem 1688