Find the Winner of the Circular Game LeetCode solution in Java
1class Solution {2public int findTheWinner(int n, int k) {3// Initialisation of the LinkedList4LinkedList<Integer> participants = new LinkedList<>();5for (int i = 1; i <= n; i++) {6participants.add(i);7}89int lastKilled = 0;10// Run the game11for (int i = 0; i < n; i++) {12for (int j = 0; j < k - 1; j++) {13participants.add(participants.poll());14}15lastKilled = participants.poll();16}17// Return the last one killed18return lastKilled;19}20}