Cody

Solution 1742553

Submitted on 5 Mar 2019
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
deck = 1:28; m = 10; out = [3 22 9 4 23 7 25 16 14 14]; assert(isequal(solitaire(deck, m),out))

2   Pass
deck = 1:28; m = 10; out = [3 22 9 4 23 7 25 16 14 14]; assert(isequal(solitaire(deck, m),out))

3   Fail
deck = 1:5; m = 10; out = [3 4 1 1 5 5 4 2 4 1]; assert(isequal(solitaire(deck, m),out))

Array indices must be positive integers or logical values. Error in solitaire (line 21) if deck(end)~=numel(deck) Error in Test3 (line 4) assert(isequal(solitaire(deck, m),out))