水题,不值一提。http://community.topcoder.com/stat?c=problem_statement&pm=1585&rd=6535
import java.util.*; public class BusinessTasks {
public String getTask(String[] list, int n) {
ArrayList<String> al = new ArrayList<String>();
for (int i = 0; i < list.length; i++) {
al.add(list[i]);
}
int len = al.size();
if (len == 0) return null;
int current = 0;
while (len != 1) {
int next = (current + n - 1) % len;
al.remove(next);
len = al.size();
current = next % len;
}
return al.get(0);
}
}