Cody

Solution 1710310

Submitted on 19 Jan 2019 by HH
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
filetext = fileread('cumax.m'); assert(isempty(strfind(filetext,'cummin'))) assert(isempty(strfind(filetext,'cummax'))) assert(isempty(strfind(filetext,'feval')))

2   Pass
x = randi(100); assert(isequal(cumax(x),cummax(x))) assert(isequal(cumax(x,1),cummax(x,1))) assert(isequal(cumax(x,2),cummax(x,2))) assert(isequal(cumax(x,1,'reverse'),cummax(x,1,'reverse'))) assert(isequal(cumax(x,2,'reverse'),cummax(x,2,'reverse'))) assert(isequal(cumax(x,'reverse'),cummax(x,'reverse')))

3   Pass
x = randi(100,randi([2 100]),1); assert(isequal(cumax(x),cummax(x))) assert(isequal(cumax(x,1),cummax(x,1))) assert(isequal(cumax(x,2),cummax(x,2))) assert(isequal(cumax(x,1,'reverse'),cummax(x,1,'reverse'))) assert(isequal(cumax(x,2,'reverse'),cummax(x,2,'reverse'))) assert(isequal(cumax(x,'reverse'),cummax(x,'reverse')))

4   Pass
x = randi(100,1,randi([2 100])); assert(isequal(cumax(x),cummax(x))) assert(isequal(cumax(x,1),cummax(x,1))) assert(isequal(cumax(x,2),cummax(x,2))) assert(isequal(cumax(x,1,'reverse'),cummax(x,1,'reverse'))) assert(isequal(cumax(x,2,'reverse'),cummax(x,2,'reverse'))) assert(isequal(cumax(x,'reverse'),cummax(x,'reverse')))

5   Pass
x = magic(10); assert(isequal(cumax(x),cummax(x))) assert(isequal(cumax(x,1),cummax(x,1))) assert(isequal(cumax(x,2),cummax(x,2))) assert(isequal(cumax(x,1,'reverse'),cummax(x,1,'reverse'))) assert(isequal(cumax(x,2,'reverse'),cummax(x,2,'reverse'))) assert(isequal(cumax(x,'reverse'),cummax(x,'reverse')))

6   Pass
x = []; assert(isequal(cumax(x),cummax(x))) assert(isequal(cumax(x,1),cummax(x,1))) assert(isequal(cumax(x,2),cummax(x,2))) assert(isequal(cumax(x,1,'reverse'),cummax(x,1,'reverse'))) assert(isequal(cumax(x,2,'reverse'),cummax(x,2,'reverse'))) assert(isequal(cumax(x,'reverse'),cummax(x,'reverse')))