[Java] Just check first and last element of rounds, O(n)
\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        int start = rounds[0], end = rounds[rounds.length - 1];\n        List<Integer> ans = new 
```\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        int start = rounds[0], end = rounds[rounds.length - 1];\n        List<Integer> ans = new ArrayList<>();\n        if(end >= start){\n            for(int i = start; i <= end; i++){\n                ans.add(i);\n            }\n        } else {\n            for(int i = 1; i <= n; i++){\n                if(i <= end || i >= start) ans.add(i);\n            }\n        }\n        return ans;\n    }\n```
[]