Cody

Problem 1668. Josephus Survivor

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

35.82% Correct | 64.18% Incorrect
Last solution submitted on Jul 29, 2016

Problem Comments

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more