Cody

# Problem 42630. Make visible max values

Solution 1991685

Submitted on 26 Oct 2019 by Nikolaos Nikolaou
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
x = [1 2 3 4 5;6 9 8 2 1;2 1 4 5 8;1 9 7 9 2]; y_correct = [0 0 0 0 5;0 9 0 0 0;0 0 0 0 8;0 9 0 9 0]; assert(isequal(visibleMax(x),y_correct))

l = 5 9 8 9 s = 0 0 0 0 0 s = 0 0 0 0 5 y = 0 0 0 0 5 s = 0 0 0 0 0 s = 0 9 0 0 0 y = 0 0 0 0 5 0 9 0 0 0 s = 0 0 0 0 0 s = 0 0 0 0 8 y = 0 0 0 0 5 0 9 0 0 0 0 0 0 0 8 s = 0 0 0 0 0 s = 0 9 0 9 0 y = 0 0 0 0 5 0 9 0 0 0 0 0 0 0 8 0 9 0 9 0

2   Pass
x = [10 20 40 85 96 15 14 12;14 15 12 16 19 17 15 0]; y_correct = [0 0 0 0 96 0 0 0;0 0 0 0 19 0 0 0]; assert(isequal(visibleMax(x),y_correct))

l = 96 19 s = 0 0 0 0 0 0 0 0 s = 0 0 0 0 96 0 0 0 y = 0 0 0 0 96 0 0 0 s = 0 0 0 0 0 0 0 0 s = 0 0 0 0 19 0 0 0 y = 0 0 0 0 96 0 0 0 0 0 0 0 19 0 0 0

3   Pass
x = [2 4 9; 9 1 0; 8 4 1; 7 5 6; 4 2 1; 4 5 6; 1 9 5]; y_correct = [0 0 9;9 0 0;8 0 0;7 0 0;4 0 0;0 0 6;0 9 0]; assert(isequal(visibleMax(x),y_correct))

l = 9 9 8 7 4 6 9 s = 0 0 0 s = 0 0 9 y = 0 0 9 s = 0 0 0 s = 9 0 0 y = 0 0 9 9 0 0 s = 0 0 0 s = 8 0 0 y = 0 0 9 9 0 0 8 0 0 s = 0 0 0 s = 7 0 0 y = 0 0 9 9 0 0 8 0 0 7 0 0 s = 0 0 0 s = 4 0 0 y = 0 0 9 9 0 0 8 0 0 7 0 0 4 0 0 s = 0 0 0 s = 0 0 6 y = 0 0 9 9 0 0 8 0 0 7 0 0 4 0 0 0 0 6 s = 0 0 0 s = 0 9 0 y = 0 0 9 9 0 0 8 0 0 7 0 0 4 0 0 0 0 6 0 9 0

4   Pass
x = [5; 8 ; 9 ; 1 ; 3 ; 4]; y_correct = [5; 8 ; 9 ; 1 ; 3 ; 4]; assert(isequal(visibleMax(x),y_correct))

l = 5 8 9 1 3 4 s = 0 s = 5 y = 5 s = 0 s = 8 y = 5 8 s = 0 s = 9 y = 5 8 9 s = 0 s = 1 y = 5 8 9 1 s = 0 s = 3 y = 5 8 9 1 3 s = 0 s = 4 y = 5 8 9 1 3 4

5   Pass
x = [2 4; Inf 1; 9 2; NaN 5]; y_correct = [0 4;Inf 0;9 0;0 5]; assert(isequal(visibleMax(x),y_correct))

l = 4 Inf 9 5 s = 0 0 s = 0 4 y = 0 4 s = 0 0 s = Inf 0 y = 0 4 Inf 0 s = 0 0 s = 9 0 y = 0 4 Inf 0 9 0 s = 0 0 s = 0 5 y = 0 4 Inf 0 9 0 0 5