C++ O(n)
cpp\nvector<int> mostVisited(int n, vector<int>& r) {\n    vector<int> res;\n    for (int i = 1; i <= n; ++i)\n        if ((r.front() <= r.back() && i >= r.fron
```cpp\nvector<int> mostVisited(int n, vector<int>& r) {\n    vector<int> res;\n    for (int i = 1; i <= n; ++i)\n        if ((r.front() <= r.back() && i >= r.front() && i <= r.back()) ||\n           (r.front() > r.back() && (i >= r.front() || i <= r.back()))) \n            res.push_back(i);\n    return res;\n}\n```
[]