Cody

Solution 1070050

Submitted on 3 Dec 2016 by SANGWOO CHANG
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 = [2 12 4 6 9 4 3 1 19 7]; y_correct = [12 9 19]; assert(isequal(find_peak(x),y_correct))

y = 12 y = 12 y = 12 y = 12 9 y = 12 9 y = 12 9 y = 12 9 y = 12 9 19 y = 12 9 19

2   Pass
x = [ones(1,9) 10 zeros(1,10)]; y_correct = 10; assert(isequal(find_peak(x),y_correct))

y = [] y = [] y = [] y = [] y = [] y = [] y = [] y = [] y = 10 y = 10 y = 10 y = 10 y = 10 y = 10 y = 10 y = 10 y = 10 y = 10 y = 10

3   Pass
x = [1:10 100 -4 2 0 0 4 5 6 0]; y_correct = [100 2 6]; assert(isequal(find_peak(x),y_correct))

y = [] y = [] y = [] y = [] y = [] y = [] y = [] y = [] y = [] y = 100 y = 100 y = 100 2 y = 100 2 y = 100 2 y = 100 2 y = 100 2 y = 100 2 6 y = 100 2 6

4   Pass
x = [1:5 6:-1:1 1:3 4:-1:0]; y_correct = [6 4]; assert(isequal(find_peak(x),y_correct))

y = [] y = [] y = [] y = [] y = 6 y = 6 y = 6 y = 6 y = 6 y = 6 y = 6 y = 6 y = 6 y = 6 4 y = 6 4 y = 6 4 y = 6 4 y = 6 4

5   Pass
x = zeros(1,10000); x(2:10:9992) = 1; y_correct = ones(1,1000); assert(isequal(find_peak(x),y_correct))

y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 y = 1 1 1 1 y = 1 1 1 1 y = 1 1 1 1 y = 1 1 1 1 y = 1 1 1 1 y = 1 1 1 1 y = 1 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1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = ...

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

y = [] y = [] y = [] y = 10 y = 10 y = 10 y = 10 y = 10 10 y = 10 10 y = 10 10 y = 10 10 y = 10 10 5 y = 10 10 5 y = 10 10 5 y = 10 10 5 y = 10 10 5 y = 10 10 5 y = 10 10 5 1 y = 10 10 5 1

7   Pass
x = [repmat([1 2 3 2 1],[1,1000])]; y_correct = 3*ones(1,1000); assert(isequal(find_peak(x),y_correct))

y = [] y = 3 y = 3 y = 3 y = 3 y = 3 y = 3 3 y = 3 3 y = 3 3 y = 3 3 y = 3 3 y = 3 3 3 y = 3 3 3 y = 3 3 3 y = 3 3 3 y = 3 3 3 y = 3 3 3 3 y = 3 3 3 3 y = 3 3 3 3 y = 3 3 3 3 y = 3 3 3 3 y = 3 3 3 3 3 y = 3 3 3 3 3 y = 3 3 3 3 3 y = 3 3 3 3 3 y = 3 3 3 3 3 y = 3 3 3 3 3 3 y = 3 3 3 3 3 3 y = 3 3 3 3 3 3 y = 3 3 3 3 3 3 y = 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3 3 3 3 y = 3 3 3 3 3 3 3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