Java | Beats > 99% | 10 lines
Intuition\n Describe your first thoughts on how to solve this problem. \n1. Maintain a boolean map of size n.\n2. Simulate the scenario described in the problem
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n1. Maintain a boolean map of size `n`.\n2. Simulate the scenario described in the problem statement and keep marking each player that receives the ball in the map.\n3. Break the loop once the ball reaches a player that had already got it before.\n4. Parse through the boolean map and extract the indices of the players that didn\'t receive the ball at all.\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\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    var map = new boolean[n];\n    int x = 0, i;\n    \n    for (i=1; !map[x]; i++) {\n      map[x] = true;\n      x = (x + i*k) % n;\n    }\n    var ans = new int[n-i+1];\n    var j = 0;\n\n    for (i=0; i<n; i++)\n      if (!map[i])\n        ans[j++] = i+1;\n\n    return ans;\n  }\n}\n```\nIf you like my solution, please upvote it!
['Simulation', 'Java']