public int remainPersonNumber(int n, int m) {
//输入不合法
if(n < 1 || m < 1)
return -1;
//初始化,存入List
LinkedList<Integer> list = new LinkedList<>();
for(int i = 0; i < n; i++) {
list.add(i);
}
int index = 0;
while(list.size() > 1) {
index = (index + m - 1)%list.size();
list.remove(index);
}
return list.get(0) + 1;
}