Cody

Solution 1608352

Submitted on 13 Aug 2018
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   Fail
x = 1:5; for spatula = sort_pancakes(x) x(1:spatula) = flip(x(1:spatula)); end assert(issorted(x))

Array indices must be positive integers or logical values. Error in sort_pancakes (line 3) while s(end)<numel(s) Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in Test1 (line 2) for spatula = sort_pancakes(x)

2   Fail
x = [6 4 2 5 3 1]; for spatula = sort_pancakes(x) x(1:spatula) = flip(x(1:spatula)); end assert(issorted(x))

Array indices must be positive integers or logical values. Error in sort_pancakes (line 3) while s(end)<numel(s) Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in Test2 (line 2) for spatula = sort_pancakes(x)

3   Fail
x = randperm(12); for spatula = sort_pancakes(x) x(1:spatula) = flip(x(1:spatula)); end assert(issorted(x))

Array indices must be positive integers or logical values. Error in sort_pancakes (line 3) while s(end)<numel(s) Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in Test3 (line 2) for spatula = sort_pancakes(x)

4   Fail
x = randperm(13); for spatula = sort_pancakes(x) x(1:spatula) = flip(x(1:spatula)); end assert(issorted(x))

Array indices must be positive integers or logical values. Error in sort_pancakes (line 3) while s(end)<numel(s) Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in Test4 (line 2) for spatula = sort_pancakes(x)

5   Fail
for k = 1:20 x = randperm(k); for spatula = sort_pancakes(x) x(1:spatula) = flip(x(1:spatula)); end assert(issorted(x)) end

Array indices must be positive integers or logical values. Error in sort_pancakes (line 3) while s(end)<numel(s) Error in sort_pancakes (line 8) [ans sort_pancakes(s(1:end-1))]; Error in Test5 (line 3) for spatula = sort_pancakes(x)

Suggested Problems

More from this Author41