Easy java most optimal solution
This solution is merely a simpler adaptation of the solutions others have posted\nTime and space : linear\n\n\n// CASE 1 : start<=end\n// count of nodes looks l
This solution is merely a simpler adaptation of the solutions others have posted\nTime and space : linear\n\n```\n// CASE 1 : start<=end\n// count of nodes looks like : [...n,n,n+1(start),n+1,n+1,n+1(end),n,n,n...]\n\n// CASE 2 : start>end\n// count of nodes looks like : [...n+1,n+1,n+1(end),n,n,n,n+1(start),n+1,n+1,n+1...]\n\nclass Solution {\n    public List<Integer> mostVisited(int n, int[] rounds) {\n        List<Integer> ans = new ArrayList();\n        int start = rounds[0] , end = rounds[rounds.length-1];\n        \n        if(start<=end){\n            while(start<=end){\n                ans.add(start);\n                start++;\n            }\n        }else{\n            for(int node = 1;node<=end;node++) ans.add(node);\n            for(int node = start;node<=n;node++) ans.add(node);\n        }\n        \n        return ans;\n    }\n}\n```\n
['Java']