C++ solution
My first try\n\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        int m = rounds.size() - 1;\n        vector<int> ve
My first try\n```\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        int m = rounds.size() - 1;\n        vector<int> vec(n + 1);\n        vec[rounds[0]]++;\n        for(int i = 1; i <= m; i++){\n            if(rounds[i] > rounds[i - 1]){\n                 for(int num = rounds[i - 1] + 1; num <= rounds[i]; num++){\n                     vec[num]++;\n                 }\n            }\n            else{\n                for(int num = rounds[i - 1] + 1; num <= n; num++){\n                    vec[num]++;\n                }\n                for(int num = 1; num <= rounds[i]; num++){\n                    vec[num]++;\n                }\n            }\n        }\n        map<int, vector<int>> map;\n        for(int i = 1; i <= n; i++){\n            map[vec[i]].push_back(i);\n        }\n        return map.rbegin()->second;\n    }\n};\n```\n\nthen go to higher level\n```\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        vector<int> res;\n        if(rounds[0] <= rounds.back()){\n            for(int i = rounds[0]; i <= rounds.back(); i++)\n                res.push_back(i);\n        }\n        else{\n            for(int i = 1; i <= rounds.back(); i++)\n                res.push_back(i);\n            for(int i = rounds[0]; i <= n; i++)\n                res.push_back(i);\n        }\n        return res;\n    }\n};\n```
[]