Cody

# Problem 42802. Rolling maximums above a threshold

Solution 1033371

Submitted on 27 Oct 2016 by Alfonso Nieto-Castanon
• Size: 19
• This is the leading solution.
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
m=magic(7);thresh=30; assert(isequal(rolling_max(m, thresh),5))

2   Pass
m=magic(14);thresh=200; assert(isequal(rolling_max(m, thresh),0));

3   Pass
m=100:-2:0;thresh=50; assert(isequal(rolling_max(m, thresh),1));

4   Pass
m=reshape(1:1000,50,[]);thresh=ceil(200*rand); assert(isequal(rolling_max(m, thresh),1000-thresh));

5   Pass
m=sort(rand(1,200));thresh=rand(); assert(isequal(rolling_max(m, thresh),sum(m>thresh)));

6   Pass
m=[1 3 5 7 9 ; 1 3 5 7 9 ; 2 4 6 8 10; 2 4 6 8 10]; thresh=2; assert(isequal(rolling_max(m, thresh),8));

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!