### Question:
JosephProblem { public int josephProblem(int n, int k) { node head = new node(1); node cur = head; for(int i = 2; i <= n; i++) { node nx = new node(i); cur.next = nx; cur = cur.next; } cur.next = head; int sum = 0; while(true) { for(int i = 0; i < k - 1; i++) { cur = cur.next; } System.out.println("delete " + cur.next.id); cur.next = cur.next.next; sum++; if(sum == n - 1) { break; } } return cur.id; }  int josephProblem(int n, int k);  }### Answer:
@Test public void test(){ JosephProblem josephProblem = new JosephProblem(); int n = 6; int k = 5; System.out.println(josephProblem.josephProblem(n, k)); }