Java Brute Force using mod
\n public List<Integer> mostVisited(int n, int[] rounds) {\n        Map<Integer, Integer> counts = new HashMap<Integer, Integer>();\n        \n        List<Inte
```\n public List<Integer> mostVisited(int n, int[] rounds) {\n        Map<Integer, Integer> counts = new HashMap<Integer, Integer>();\n        \n        List<Integer> res = new ArrayList<>();\n        \n        counts.put(rounds[0], 1);\n        \n        for(int i = 1; i < rounds.length; i++) {\n            int start = rounds[i-1];\n            int end = rounds[i] >= start ? rounds[i]: (rounds[i] + n);\n            for(int j = start+1; j <= end; j++) {\n                if(j % n == 0) {\n                    counts.put(n, counts.getOrDefault(n, 0)+1);\n                } else {\n                    counts.put(j%n, counts.getOrDefault(j%n, 0)+1);\n                }\n            }\n        }\n        \n        int max = -1;\n\n        for(Integer key: counts.keySet()) {\n            if(counts.get(key) > max) {\n                max = counts.get(key);\n            }\n        }\n        \n        for(Integer key: counts.keySet()) {\n            if(counts.get(key) == max) {\n                res.add(key);\n            }\n        }\n        Collections.sort(res);\n        return res;\n    }\n```
[]