package leetcode;

/**
 * https://leetcode.com/problems/find-the-winner-of-the-circular-game/
 */
public class Problem1823 {
    public int findTheWinner(int n, int k) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1823 prob = new Problem1823();
        System.out.println(prob.findTheWinner(5, 2)); // 3
        System.out.println(prob.findTheWinner(6, 5)); // 1
    }
}

@@ -12,16 +12,68 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 /**%0A * h
@@ -227,249 +227,283 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1823 prob = new Problem1823();%0A        System.out.println(prob.findTheWinner(5, 2)); // 3%0A        System.out.println(prob.findTheWinner(6, 5)); // 1
+List%3CInteger%3E list = new ArrayList%3C%3E();%0A        for (int i = 1; i %3C= n; i++) %7B%0A            list.add(i);%0A        %7D%0A        int i = 0;%0A        while (list.size() %3E 1) %7B%0A            i = (i + k - 1) %25 list.size();%0A            list.remove(i);%0A        %7D%0A        return list.get(0);
 %0A   

Solve problem 1823