Find the Winner of the Circular Game LeetCode solution in C++
1class Solution {2public:3int findTheWinner(int n, int k) {4vector<int> temp;56for (int i = 1; i <= n; i++) temp.push_back(i);78int i = 0;910while (temp.size() > 1) {11int t = temp.size();12i = (i + k - 1) % t;13temp.erase(temp.begin() + i);14}15return *temp.begin();16}17};