Cody

Problem 233. Reverse the vector

Solution 1838169

Submitted on 4 Jun 2019 by Renee Bach
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(reverseVector(x),y_correct))

y = 1 c = 2

2   Pass
x = -10:1; y_correct = 1:-1:-10; assert(isequal(reverseVector(x),y_correct))

y = 1 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 c = 2 y = 1 0 -8 -7 -6 -5 -4 -3 -2 -1 0 1 c = 3 y = 1 0 -1 -7 -6 -5 -4 -3 -2 -1 0 1 c = 4 y = 1 0 -1 -2 -6 -5 -4 -3 -2 -1 0 1 c = 5 y = 1 0 -1 -2 -3 -5 -4 -3 -2 -1 0 1 c = 6 y = 1 0 -1 -2 -3 -4 -4 -3 -2 -1 0 1 c = 7 y = 1 0 -1 -2 -3 -4 -5 -3 -2 -1 0 1 c = 8 y = 1 0 -1 -2 -3 -4 -5 -6 -2 -1 0 1 c = 9 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -1 0 1 c = 10 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 0 1 c = 11 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 1 c = 12 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 c = 13

3   Pass
x = 'able was i ere i saw elba'; y_correct = 'able was i ere i saw elba'; assert(isequal(reverseVector(x),y_correct))

y = 'able was i ere i saw elba' c = 2 y = 'able was i ere i saw elba' c = 3 y = 'able was i ere i saw elba' c = 4 y = 'able was i ere i saw elba' c = 5 y = 'able was i ere i saw elba' c = 6 y = 'able was i ere i saw elba' c = 7 y = 'able was i ere i saw elba' c = 8 y = 'able was i ere i saw elba' c = 9 y = 'able was i ere i saw elba' c = 10 y = 'able was i ere i saw elba' c = 11 y = 'able was i ere i saw elba' c = 12 y = 'able was i ere i saw elba' c = 13 y = 'able was i ere i saw elba' c = 14 y = 'able was i ere i saw elba' c = 15 y = 'able was i ere i saw elba' c = 16 y = 'able was i ere i saw elba' c = 17 y = 'able was i ere i saw elba' c = 18 y = 'able was i ere i saw elba' c = 19 y = 'able was i ere i saw elba' c = 20 y = 'able was i ere i saw elba' c = 21 y = 'able was i ere i saw elba' c = 22 y = 'able was i ere i saw elba' c = 23 y = 'able was i ere i saw elba' c = 24 y = 'able was i ere i saw elba' c = 25 y = 'able was i ere i saw elba' c = 26

Suggested Problems

More from this Author1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!