[Java] Simple Explanation: It took me a while to understand this question
\npublic List<Integer> mostVisited(int n, int[] rounds) {\n        // Only first and last numbers(start and end of the give array) matters... why?\n        // T
```\npublic List<Integer> mostVisited(int n, int[] rounds) {\n        // Only first and last numbers(start and end of the give array) matters... why?\n        // The entire marathon has no track sector gap.\n        // Which means.. it doesn\'t matter how many times we rotate.. it will just cancel out...\n        // Cancel out means: if we visit 1,2,3,4 all 1 times.. do we get the max? no.. because all are the same..\n        // which means... if we visit [1,3,1,2], whatever is in between doesn\'t matter..\n        //\n        // And there can be only 2 cases:\n        // Case 1 : If start <= end\n        //     --->> In this case we return the range [start, end].\n        // Case 2 : If end < start\n        //     --->> In this case we return return the range [1, end] + range [start, n]\n        //\n        // What if we visited [1,1] -->> Invalid input because on the Constraints it says:\n        //                               rounds[i] != rounds[i + 1]\n        List<Integer> list = new ArrayList<>();\n        int length = rounds.length;\n        int start = rounds[0];\n        int end = rounds[length-1];\n        \n        // Case 1: If start <= end, return the range [start, end].\n        if(start <= end){\n            // loop from start to end\n            while(start <= end) {\n                list.add(start);\n                start++;\n            }\n        }else{\n            // Case 2: If end < start, return the range [1, end] + range [start, n].\n\n            int x = 1;\n            \n            // now we are getting this range: [1, end]\n            // Remember: order matters\n            while(x <= end){\n                list.add(x);\n                x++;\n            }\n            // n -> number of sectors\n            // now we are getting this range: [start, n]\n            while(start <= n){\n                list.add(start);\n                start++;\n            }\n        }\n        return list;\n    }\n```
[]