Cody

Solution 1946824

Submitted on 23 Sep 2019
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
seq=randi(5,1,10); seq_max = max(seq); seq_idx= find(seq==seq_max,1,'first'); [max_val, max_idx] = max_val_idx(seq); assert(isequal(max_val,seq_max)); assert(isequal(max_idx,seq_idx));

M = 5 I = 9

2   Fail
seq=rand(10); seq_max = max(seq(:)); seq_idx= find(seq==seq_max,1,'first'); [max_val, max_idx] = max_val_idx(seq); assert(isequal(max_val,seq_max)); assert(isequal(max_idx,seq_idx));

M = 0.9657 0.9091 0.8647 0.9662 0.8284 0.9399 0.9125 0.9464 0.9792 0.9162 I = 7 9 4 5 9 1 1 5 9 8

Assertion failed.

3   Fail
seq=randn(10); seq_max = max(seq(:)); seq_idx= find(seq==seq_max,1,'first'); [max_val, max_idx] = max_val_idx(seq); assert(isequal(max_val,seq_max)); assert(isequal(max_idx,seq_idx));

M = 2.4147 2.2816 1.8485 0.6417 2.4449 2.0299 1.2520 2.2593 2.2699 2.3128 I = 7 6 6 3 2 9 4 3 9 10

Assertion failed.

4   Pass
seq=randi(2^15,128,1); seq_max = max(seq(:)); seq_idx= find(seq==seq_max,1,'first'); [max_val, max_idx] = max_val_idx(seq); assert(isequal(max_val,seq_max)); assert(isequal(max_idx,seq_idx));

M = 32164 I = 82