Cody

Solution 1945082

Submitted on 21 Sep 2019
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
n = 1; y_correct = 1; assert(isequal(surround(n),y_correct))

ans = 1 st = 1 ans = 1

2   Fail
n=3 y_correct = [1 2 1 2 3 2 1 2 1]; assert(isequal(surround(n),y_correct))

n = 3 ans = 2 st = 2 1 3 2 ans = 2 2 1 3 3 2 1 2 1

Assertion failed.

3   Fail
n=5 y_correct = [1 2 3 2 1 2 3 4 3 2 3 4 5 4 3 2 3 4 3 2 1 2 3 2 1]; assert(isequal(surround(n),y_correct))

n = 5 ans = 3 st = 3 2 1 4 3 2 5 4 3 ans = 2 3 3 2 1 3 4 4 3 2 4 5 5 4 3 2 3 4 3 2 1 2 3 2 1

Assertion failed.

4   Fail
n=7 y_correct = [1 2 3 4 3 2 1 2 3 4 5 4 3 2 3 4 5 6 5 4 3 4 5 6 7 6 5 4 3 4 5 6 5 4 3 2 3 4 5 4 3 2 1 2 3 4 3 2 1]; assert(isequal(surround(n),y_correct))

n = 7 ans = 4 st = 4 3 2 1 5 4 3 2 6 5 4 3 7 6 5 4 ans = 2 3 4 4 3 2 1 3 4 5 5 4 3 2 4 5 6 6 5 4 3 5 6 7 7 6 5 4 3 4 5 6 5 4 3 2 3 4 5 4 3 2 1 2 3 4 3 2 1

Assertion failed.

5   Fail
n=11 y_correct = [ 1 2 3 4 5 6 5 4 3 2 1 2 3 4 5 6 7 6 5 4 3 2 3 4 5 6 7 8 7 6 5 4 3 4 5 6 7 8 9 8 7 6 5 4 5 6 7 8 9 10 9 8 7 6 5 6 7 8 9 10 11 10 9 8 7 6 5 6 7 8 9 10 9 8 7 6 5 4 5 6 7 8 9 8 7 6 5 4 3 4 5 6 7 8 7 6 5 4 3 2 3 4 5 6 7 6 5 4 3 2 1 2 3 4 5 6 5 4 3 2 1]; assert(isequal(surround(n),y_correct))

n = 11 ans = 6 st = 6 5 4 3 2 1 7 6 5 4 3 2 8 7 6 5 4 3 9 8 7 6 5 4 10 9 8 7 6 5 11 10 9 8 7 6 ans = 2 3 4 5 6 6 5 4 3 2 1 3 4 5 6 7 7 6 5 4 3 2 4 5 6 7 8 8 7 6 5 4 3 5 6 7 8 9 9 8 7 6 5 4 6 7 8 9 10 10 9 8 7 6 5 7 8 9 10 11 11 10 9 8 7 6 5 6 7 8 9 10 9 8 7 6 5 4 5 6 7 8 9 8 7 6 5 4 3 4 5 6 7 8 7 6 5 4 3 2 3 4 5 6 7 6 5 4 3 2 1 2 3 4 5 6 5 4 3 2 1

Assertion failed.

Suggested Problems

More from this Author1