reverse of prefix sum
\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        vector<int> sectors(n + 2, 0);\n        for (int i = 1; i <  rou
```\nclass Solution {\npublic:\n    vector<int> mostVisited(int n, vector<int>& rounds) {\n        vector<int> sectors(n + 2, 0);\n        for (int i = 1; i <  rounds.size(); ++i) {\n            int from = rounds[i - 1], to = rounds[i];\n            if (from < to) {\n                ++sectors[i == 1 ? from : from + 1];\n                --sectors[to + 1];\n            } else {\n                ++sectors[i == 1 ? from : from + 1];\n                --sectors[n + 1];\n                ++sectors[0];\n                --sectors[to + 1];\n            }\n        }\n        partial_sum(begin(sectors), end(sectors), begin(sectors));\n        int largest = *max_element(begin(sectors), end(sectors));\n        vector<int> ans;\n        for (int i = 1; i < sectors.size() - 1; ++i) {\n            if (sectors[i] == largest) {\n                ans.emplace_back(i);\n            }\n        }\n        return ans;\n    }\n};\n\n```
[]