c++ O(n) solution Beats 95.24%
\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> circularGameLosers(int n, int k) {\n        int turn = 2;\n        vector<int> vec, vis(n);\n        int i = k;\n        while(i >= n) i -= n;\n        vis[0] = 1;\n\n        while(true) {\n            if(vis[i]) break;\n            vis[i] = 1;\n            i += (k * turn);\n            while(i >= n) i = i - n;\n            turn++;\n        }\n\n        for(int i = 0; i < n; i++) {\n            if(!vis[i]) vec.push_back(i + 1);\n        }\n        return vec;\n    }\n};\n```
['C++']