package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/most-visited-sector-in-a-circular-track/
 */
public class Problem1560 {
    public List<Integer> mostVisited(int n, int[] rounds) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1560 prob = new Problem1560();
        System.out.println(prob.mostVisited(4, new int[]{1,3,1,2})); // [1,2]
        System.out.println(prob.mostVisited(2, new int[]{2,1,2,1,2,1,2,1,2})); // [2]
        System.out.println(prob.mostVisited(7, new int[]{1,3,5,7})); // [1,2,3,4,5,6,7]
        System.out.println(prob.mostVisited(7, new int[]{1,3,4,3})); // [1,2,3]
    }
}

@@ -12,16 +12,69 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Arrays;%0A
 import j
@@ -88,16 +88,16 @@
 l.List;%0A
-
 %0A/**%0A * 
@@ -270,466 +270,605 @@
     
-// TODO%0A        return null
+int%5B%5D counts = new int%5Bn%5D;%0A        int prev = rounds%5B0%5D - 1
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1560 prob = new Problem1560();%0A        System.out.println(prob.mostVisited(4, new int%5B%5D%7B1,3,1,2%7D)); // %5B1,2%5D%0A        System.out.println(prob.mostVisited(2, new int%5B%5D%7B2,1,2,1,2,1,2,1,2%7D)); // %5B2%5D%0A        System.out.println(prob.mostVisited(7, new int%5B%5D%7B1,3,5,7%7D)); // %5B1,2,3,4,5,6,7%5D%0A        System.out.println(prob.mostVisited(7, new int%5B%5D%7B1,3,4,3%7D)); // %5B1,2,3%5D
+for (int i = 1; i %3C rounds.length; i++) %7B%0A            int j = prev;%0A            while (j != rounds%5Bi%5D - 1) %7B%0A                counts%5Bj%5D++;%0A                j = (j + 1) %25 n;%0A            %7D%0A            prev = rounds%5Bi%5D - 1;%0A        %7D%0A        counts%5Bprev%5D++;%0A        List%3CInteger%3E answer = new ArrayList%3C%3E();%0A        int max = Arrays.stream(counts).max().getAsInt();%0A        for (int i = 0; i %3C counts.length; i++) %7B%0A            if (counts%5Bi%5D == max) %7B%0A                answer.add(i + 1);%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1560