Only first and last value matters | O(n) solution
The answer will always be from the start point to the lastEnd value in the array. It does not matter how many times we looped in the path, the end answer will a
The answer will always be from the start point to the lastEnd value in the array. It does not matter how many times we looped in the path, the end answer will always begin from start and go till the end value. \n\nSpecifically 2 cases 1) start< End  2)  start > End which needs to be handled \n\n```\nclass Solution {\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        int start = rounds[0];\n        int end = rounds[rounds.length-1];\n        \n        List<Integer> res = new ArrayList<>();\n        \n        if(start <= end) {\n            while(start<=end){\n                res.add(start++);\n            }\n        } else {\n                int i=1;\n                while(i<=end) {\n                    res.add(i++);\n                }\n                while(start <= n) {\n                    res.add(start++);\n                }\n        }\n        return res;\n    }\n}
[]