C++👨🏻‍💻 | Easy ✅| Do what Que Says 🫡
Intuition\nDo What Question Says. Here, I am visiting every person and marking it visited if it was not visited before. The loop ends when we visit to a person 
# Intuition\n**Do What Question Says**. Here, I am visiting every person and marking it visited if it was not visited before. The loop ends when we visit to a person who was visited before.\n\n# Approach\nTaken a vector vis (visited, we can say) which will mark according to the number of the person. Here, I have taken the vector of size \'n+1\', here index 0 has no use.\nStarting from pos = 1 to till we go.\nif(pos==0) then I making pos = n, means pos is divisible by n so it must be \'n\' as we are representing the numbers on the range of 1 to n only.\n\n# Complexity\n- Time complexity:\nIn the worst case, we are visiting every node so **TC = O(N)**\n\n- Space complexity:\n**SC = O(N) + O(N) = O(N)**, for visited vector and ans vector\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> circularGameLosers(int n, int k) {\n        vector<int> vis(n+1, 0);\n\n        int pos = 1;\n        int i=1;\n        vis[1] = -1;\n        while(true){\n            pos = ( i*k + pos ) % n;\n            if(pos == 0) pos = n;\n            if(vis[pos] == -1){\n                break;\n            }\n            vis[pos] = -1;\n            i++;\n        }\n\n        vector<int> ans;\n        for(int i=1; i<=n; i++){\n            if(vis[i] == 0) ans.push_back(i);\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'C++']