Cody

Solution 965738

Submitted on 12 Sep 2016 by Gergely Patay
  • Size: 26
  • This is the leading solution.
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('vadd.m'); assert(isempty(strfind(filetext,'regexp'))) assert(isempty(strfind(filetext,'switch')))

2   Pass
v1 = [1 4]; v2 = [3 8 6 1]; v3_correct = [3 8 7 5]; assert(isequal(vadd(v1,v2),v3_correct)) assert(isequal(vadd(v2,v1),v3_correct))

v3 = 3 8 7 5 v3 = 3 8 7 5

3   Pass
v1 = [9 9]; v2 = [9 9]; v3_correct = [1 9 8]; assert(isequal(vadd(v1,v2),v3_correct)) assert(isequal(vadd(v2,v1),v3_correct))

v3 = 1 9 8 v3 = 1 9 8

4   Pass
v1 = [9 4 2 3 5 6 7 3 3 5 5 4 6 3 2 4 2 5 7 7 8 5 4 3 4 7 8 7]; v2 = [3 5 7 3 4 5 2 5 4 8 7 6 4 3 7 8 9 5 4 0 3 2 7 9 0 3 2 8 9]; v3_correct = [4 5 1 5 8 0 9 2 8 2 3 1 9 0 1 1 3 7 9 8 1 1 3 3 3 8 0 7 6]; assert(isequal(vadd(v1,v2),v3_correct)) assert(isequal(vadd(v2,v1),v3_correct))

v3 = Columns 1 through 16 4 5 1 5 8 0 9 2 8 2 3 1 9 0 1 1 Columns 17 through 29 3 7 9 8 1 1 3 3 3 8 0 7 6 v3 = Columns 1 through 16 4 5 1 5 8 0 9 2 8 2 3 1 9 0 1 1 Columns 17 through 29 3 7 9 8 1 1 3 3 3 8 0 7 6