id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com josephus > array_josephusSolver
prev  |  next  |  chance

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)

public int array_josephusSolver(int n, int s) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy