[100%]
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    set<int> mp[2];\n    vector<int> dp;\n\n    void insert(int i) {\n        if (dp[i] != INT_MAX) return;\n        mp[(i % 2)].insert(i);\n    }\n\n    void mark(int l, int r, int i, int k, deque<int>& q) {\n        if (r < l) return;\n        int b = i % 2;\n        set<int>& se = (k % 2) ? mp[b] : mp[1 - b];\n        auto iter = se.lower_bound(l);\n        while (iter != se.end()) {\n            int cur = *iter;\n            if ((cur) > r) break;\n            dp[cur] = dp[i] + 1;\n            q.push_back(cur);\n            iter = se.erase(iter);\n        }\n    }\n   \n    vector<int> minReverseOperations(int n, int p, vector<int>& banned, int k) {       \n        dp = vector<int>(n, INT_MAX);\n        dp[p] = 0;\n        for (auto b : banned) dp[b] = -1;\n        for (int i = 0; i < n; i++) insert(i);\n\n        deque<int> q;\n        q.push_back(p);\n        while (!q.empty()) {\n            int len = q.size();\n            for (int i = 0; i < len; i++) {\n                int cur = q.front();\n                q.pop_front();\n\n                int l = (cur - k + 1) >= 0 ? \n                           cur - k + 1 : k - 1 - cur ;\n                int r = (cur + k -1) <= n ? \n                            cur + k - 1 : n + n - k - 1 - cur;\n                mark(l, r, cur, k, q);\n            }\n        }\n\n        for (auto& c : dp) if (c == INT_MAX) c = -1;\n        return dp;\n    }\n};\n```
['C++']