Cody

# Problem 1668. Josephus Survivor

Solution 732608

Submitted on 9 Sep 2015 by Sebastian
• Size: 10
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% % Fixed 6/21/13 n=40; k=7; s_expect=24; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

2   Pass
%% n=4; k=2; s_expect=1; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

3   Pass
%% n=40; k=2; s_expect=17; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

4   Pass
%% n=37; k=6; s_expect=10; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

5   Pass
%% n=29; k=28; s_expect=3; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

6   Pass
%% n=101; k=1; s_expect=101; survivor=solve_josephus(n,k); assert(isequal(survivor,s_expect))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!