Simple O(n) Java Explanaition
\nclass Solution {\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        int start = rounds[0], end = rounds[rounds.length -1];\n        List<In
```\nclass Solution {\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        int start = rounds[0], end = rounds[rounds.length -1];\n        List<Integer> output = new ArrayList();\n        /*\n        Two diff cases, two different logic\n            1) Start <= End\n                --> Add indices from start to end!\n            2) Start > End\n                Add indices from 1 to n --> But none after end to start!\n        */\n        if(start <= end){\n            for(int i = start; i <= end; i++){\n                output.add(i);  \n            }\n        } else {\n            for(int i = 1; i <= n; i++){\n                if(i == end + 1) i = start;\n                output.add(i);\n            }\n        }\n        return output;\n    }\n}\n```
[]