about | help | code help+videos | done | prefs |
list_josephusSolver
Given a List of people (integers) numbered starting with 1, and a skip number "s", return the final spot that will be surviving if they play the Josephus elimination game. This time, your solution needs to call list.remove(#) to remove eliminated players from the game. Once the list is size 1, you can return list.get(0) which should have the spot number of the final survivor! list_josephusSolver([1, 2], 2) → 1 list_josephusSolver([1, 2, 3], 2) → 3 list_josephusSolver([1, 2, 3, 4], 2) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy