1class Solution {2public:3vector<int> deckRevealedIncreasing(vector<int> &deck) {4int n = deck.size(), idx = 0, idx1 = 0;5vector<int> res(n, -1);6sort(deck.begin(), deck.end());7bool found = 1;8while (idx < n) {9if (res[idx1] == -1 and found) {10res[idx1] = deck[idx];11found = 0;12idx++;13} else if (res[idx1] == -1)14found = 1;15idx1 = (idx1 + 1) % n;16}17return res;18}19};