The Josephus Challenge is to find the position that is the last remaining when every Kth item is removed from a list of N items. The removal wraps from the end to the start.
Input: N, K where N is the number of players and K is the removal period.
Output: S the last position remaining
Example: N=4 K=2 produces the sequence
1 2 3 4; 1 3 4; 1 3; 1
Comment:
This is a replication of Decimation by James but has a different Historical story reference.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers42
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15798 Solvers
-
Sort a list of complex numbers based on far they are from the origin.
5809 Solvers
-
198 Solvers
-
Back to basics 12 - Input Arguments
624 Solvers
-
07 - Common functions and indexing 1
454 Solvers
More from this Author306
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Hi Richard, this problem is the same as this other one: http://www.mathworks.de/matlabcentral/cody/problems/1092-decimation
isn't it??
So I think there is an error on test case number 4 and 5... :-(
Really like this problem, btw i also got issues with those test cases
I made the Decimation problem referenced above, and I had problems with my test suite as well. Looks like we both would have been standing in the wrong spot in the circle... :-(
I thought I had the right solutions but was unsure. I searched for Josephus to see if this was a duplication, I will look at decimation.