about | help | code help+videos | done | prefs |
array_josephusSolver
Given a number of people "n", and a skip number "s", return the final spot that will be surviving if they play the Josephus elimination game. Note: You MUST use a boolean array to solve this problem rather than differential calculus or modulo based solutions. If you haven't heard of the Josephus problem, see this page: http://webspace.ship.edu/deensley/mathdl/Joseph.html array_josephusSolver(2, 2) → 1 array_josephusSolver(3, 2) → 3 array_josephusSolver(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