Cody

# Problem 42894. Find longest run

Solution 1601187

Submitted on 5 Aug 2018
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   Fail
binary_array = [1 1 0 1]; expected_length = 2; expected_index = 1; [actual_length actual_index] = longest_run(binary_array); assert(isequal(expected_length, actual_length)); assert(isequal(expected_index, actual_index));

l = 2 i = 1

One or more output arguments not assigned during call to "varargout". Error in Test1 (line 4) [actual_length actual_index] = longest_run(binary_array);

2   Fail
binary_array = [1 1 0 1 0 0 0 0 1 1 1]; expected_length = 4; expected_index = 5; [actual_length actual_index] = longest_run(binary_array); assert(isequal(expected_length, actual_length)); assert(isequal(expected_index, actual_index));

l = 4 i = 5

One or more output arguments not assigned during call to "varargout". Error in Test2 (line 4) [actual_length actual_index] = longest_run(binary_array);

3   Fail
binary_array = [1 0]; expected_length = 1; expected_index = 1; [actual_length actual_index] = longest_run(binary_array); assert(isequal(expected_length, actual_length)); assert(isequal(expected_index, actual_index));

l = 1 i = 1 2

One or more output arguments not assigned during call to "varargout". Error in Test3 (line 4) [actual_length actual_index] = longest_run(binary_array);

4   Fail
binary_array = ; expected_length = 1; expected_index = 1; [actual_length actual_index] = longest_run(binary_array); assert(isequal(expected_length, actual_length)); assert(isequal(expected_index, actual_index));

l = 1 i = 1

One or more output arguments not assigned during call to "varargout". Error in Test4 (line 4) [actual_length actual_index] = longest_run(binary_array);

5   Fail
binary_array = [1 1 1 1 1 1]; expected_length = 6; expected_index = 1; [actual_length actual_index] = longest_run(binary_array); assert(isequal(expected_length, actual_length)); assert(isequal(expected_index, actual_index));

l = 6 i = 1

One or more output arguments not assigned during call to "varargout". Error in Test5 (line 4) [actual_length actual_index] = longest_run(binary_array);