2682. Find the Losers of the Circular Game - JAVA SOL
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] circularGameLosers(int n, int k) {\n    int[] result = new int[n];\n    int[] p = new int[n + 1];\n    int i = 1, j = 1, count = 0; \n    while (p[i] == 0) {\n        p[i] = -1;\n        i = (i + (j * k));\n        while (i > n)\n            i -= n;\n        j++;\n    }\n    for (i = 1; i <= n; i++) {\n        if (p[i] != -1) {\n            result[count++] = i;\n        }\n    }\n    return Arrays.copyOf(result, count);\n    }\n}\n```
['Java']