[JAVA] Easy - Simulation✅Fully Explained
Feel free to suggest any improvements, corrections\uD83D\uDC4D\uD83C\uDFFB\nDo UPVOTE\uD83D\uDD3A\n\nclass Solution {\n    public int[] circularGameLosers(int n
Feel free to suggest any improvements, corrections\uD83D\uDC4D\uD83C\uDFFB\nDo **UPVOTE**\uD83D\uDD3A\n```\nclass Solution {\n    public int[] circularGameLosers(int n, int k) {\n        int[] map = new int[n];\n\t\t//map[i] tracks the number of times ith member recieves the ball\n        \n        int i = 0, cnt = 1;\n        while(true){\n            map[i]++;\n            if(map[i] == 2) break; //break out of the loop whenever any member recieves the ball 2nd time, i.e. GAME_OVER\n            i = (i + (cnt * k)) % n;\n            cnt++; //to increase the multiple of k: k, 2*k, 3*k, 4*k, etc\n        }\n        \n        int len = 0; //For storing how many members are the losers, i.e. did not recieve the ball even once\n        for(int num : map) if(num == 0) len++;\n        \n        \n        int index = 0, ans[] = new int[len];\n        for(int j=0;j<n;j++){\n          if(map[j] == 0) ans[index++] = j+1;  \n        }\n        return ans;\n    }\n}\n```
['Simulation', 'Java']