2682. Find the Losers of the Circular Game
Code


# Code
```c []
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* circularGameLosers(int n, int k, int* returnSize) {
    int *H, *ans, count = 0, i, t = k;
    H = (int *)malloc(sizeof(int)*(n));
    for(int i = 0; i < n; i++){
        H[i] = 1;
    }
    i = 0;
    while(H[i]){
        H[i] = 0;
        i = (i + k) % n;
        k += t;
    }
    for(int i = 0; i < n; i++){
        if(H[i])
        count++;
    }
    ans = (int *)malloc(sizeof(int) * (count));
    i = 0;
    for(int j = 0; j < n; j++){
        if(H[j])
        ans[i++] = j + 1;
    }
    *returnSize = count;
    return ans;
}
```
['C']