Cody

Solution 1426666

Submitted on 28 Jan 2018 by Jihye Sofia Seo
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('largest.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden') assert(isempty(strfind(filetext, 'max')),'max() forbidden') assert(isempty(strfind(filetext, 'min')),'min() forbidden') assert(isempty(strfind(filetext, 'sort')),'sort() forbidden')

2   Pass
v = [4 7 1 6]; x_correct = 7; assert(isequal(largest(v),x_correct))

m1 = 4 m1 = 7 m2 = 1 m2 = 6

3   Pass
v = [1 1 1 1]; x_correct = 1; assert(isequal(largest(v),x_correct))

m1 = 1 m2 = 1

4   Pass
v = [4 3 2 1]; x_correct = 4; assert(isequal(largest(v),x_correct))

m1 = 4 m2 = 2

5   Pass
v = [1 2 3 4]; x_correct = 4; assert(isequal(largest(v),x_correct))

m1 = 1 m1 = 2 m2 = 3 m2 = 4 x = 4

6   Pass
v = [1 1 3 5]; x_correct = 5; assert(isequal(largest(v),x_correct))

m1 = 1 m2 = 3 m2 = 5 x = 5

7   Pass
v = [3 3 2 4]; x_correct = 4; assert(isequal(largest(v),x_correct))

m1 = 3 m2 = 2 m2 = 4 x = 4

8   Pass
v = [2 3 1 6]; x_correct = 6; assert(isequal(largest(v),x_correct))

m1 = 2 m1 = 3 m2 = 1 m2 = 6 x = 6

9   Pass
v = [3 3 3 9]; x_correct = 9; assert(isequal(largest(v),x_correct))

m1 = 3 m2 = 3 m2 = 9 x = 9