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

 

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

Given a List of people (integers) numbered starting with 1, and a skip number "s", return a list containing the final spot that will be surviving at index 0 and the second to last person eliminated at index 1 if they play the Josephus elimination game. Copy your solution from list_josephusSolver and then modify it to return a list of integers with the two answers instead of just the integer index of the final spot.


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

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

public List<Integer> list_josephusBonus(List<Integer> list, 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