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

 

array_josephusBonus


Given a number of people "n", and a skip number "s", return the final TWO SPOTS that will be surviving if they play the Josephus elimination game. You will need to create an integer array of size 2 for the answer. Index 0 should contain the FINAL SPOT where you should stand and Index 1 should contain the SECOND TO LAST SPOT ELIMINATED where your best friend should stand!


array_josephusBonus(2, 2) → [1, 2]
array_josephusBonus(3, 2) → [3, 1]
array_josephusBonus(4, 2) → [1, 3]

...Save, Compile, Run (ctrl-enter)

public int[] array_josephusBonus(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