Cody

Solution 331675

Submitted on 9 Oct 2013
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
1

ans = 1

2   Pass
%% assert(isequal(true,isLIFO([1;2],[4;3]))); 2

ans = 2

3   Pass
%% assert(isequal(false,isLIFO([1;2],[3;4]))); 3

ans = 3

4   Pass
%% for i=1:100 In = randi(20,100,1); Out = randi(20,100,1); valid = In<Out; In=In(valid); Out=Out(valid); TF=true; for k=1:numel(In)-1 for l=k+1:numel(In) if (In(k)<In(l)) && (Out(k) < Out(l)) TF = false; end end end assert(isequal(TF,isLIFO(In,Out))); end 4

ans = 4

5   Pass
%% assert(isequal(true,isLIFO([1;2],[3;3]))); 5

ans = 5

6   Pass
%% assert(isequal(true,isLIFO([2;2],[4;3]))); 6

ans = 6

7   Pass
%% assert(isequal(true,isLIFO([2;2],[7;6]))); 7

ans = 7

8   Fail
%% assert(isequal(false,isLIFO([2;1],[4;3])));

Error: Assertion failed.