Cody

Solution 1925264

Submitted on 7 Sep 2019 by Simon Wittigschlager
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 = 1; y_correct = 1; assert(isequal(vecsum(x),y_correct))

k = 0 k = 1 y = 1

2   Pass
x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

k = 0 k = 1 k = 3 k = 6 k = 11 y = 11

3   Pass
x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

k = 0 k = 1 k = 3 k = 6 k = 11 y = 11

4   Pass
x = 1:100; y_correct = 5050; assert(isequal(vecsum(x),y_correct))

k = 0 k = 1 k = 3 k = 6 k = 10 k = 15 k = 21 k = 28 k = 36 k = 45 k = 55 k = 66 k = 78 k = 91 k = 105 k = 120 k = 136 k = 153 k = 171 k = 190 k = 210 k = 231 k = 253 k = 276 k = 300 k = 325 k = 351 k = 378 k = 406 k = 435 k = 465 k = 496 k = 528 k = 561 k = 595 k = 630 k = 666 k = 703 k = 741 k = 780 k = 820 k = 861 k = 903 k = 946 k = 990 k = 1035 k = 1081 k = 1128 k = 1176 k = 1225 k = 1275 k = 1326 k = 1378 k = 1431 k = 1485 k = 1540 k = 1596 k = 1653 k = 1711 k = 1770 k = 1830 k = 1891 k = 1953 k = 2016 k = 2080 k = 2145 k = 2211 k = 2278 k = 2346 k = 2415 k = 2485 k = 2556 k = 2628 k = 2701 k = 2775 k = 2850 k = 2926 k = 3003 k = 3081 k = 3160 k = 3240 k = 3321 k = 3403 k = 3486 k = 3570 k = 3655 k = 3741 k = 3828 k = 3916 k = 4005 k = 4095 k = 4186 k = 4278 k = 4371 k = 4465 k = 4560 k = 4656 k = 4753 k = 4851 k = 4950 k = 5050 y = 5050