Cody

Solution 1983682

Submitted on 20 Oct 2019 by Nikolaos Nikolaou
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))

survivor = 24

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

survivor = 1

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

survivor = 17

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

survivor = 10

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

survivor = 3

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

survivor = 101