Cody

Problem 43033. Create a constant offset.

Solution 1209405

Submitted on 10 Jun 2017
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
a = 1; offset = 2 y_correct = 3; assert(isequal(constant_offset(a,offset),y_correct))

offset = 2 ans = 3

2   Pass
a = [-1 1]; offset = 2 y_correct = [1 3]; assert(isequal(constant_offset(a,offset),y_correct))

offset = 2 ans = 3 ans = 1 3

3   Fail
a = [-10:1:1]; offset = 10 y_correct = [0:11]; assert(isequal(constant_offset(a,offset),y_correct))

offset = 10 ans = 3 ans = -1 0 1 11

Assertion failed.