Cody

# Problem 233. Reverse the vector

Solution 2250206

Submitted on 2 May 2020 by Kiran Jojare
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

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

temp = -10 x = 1 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 x = 1 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 -10 temp = -9 x = 1 0 -8 -7 -6 -5 -4 -3 -2 -1 0 -10 x = 1 0 -8 -7 -6 -5 -4 -3 -2 -1 -9 -10 temp = -8 x = 1 0 -1 -7 -6 -5 -4 -3 -2 -1 -9 -10 x = 1 0 -1 -7 -6 -5 -4 -3 -2 -8 -9 -10 temp = -7 x = 1 0 -1 -2 -6 -5 -4 -3 -2 -8 -9 -10 x = 1 0 -1 -2 -6 -5 -4 -3 -7 -8 -9 -10 temp = -6 x = 1 0 -1 -2 -3 -5 -4 -3 -7 -8 -9 -10 x = 1 0 -1 -2 -3 -5 -4 -6 -7 -8 -9 -10 temp = -5 x = 1 0 -1 -2 -3 -4 -4 -6 -7 -8 -9 -10 x = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10

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))

temp = 'a' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'b' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'l' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'e' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = ' ' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'w' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'a' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 's' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = ' ' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'i' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = ' ' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' temp = 'e' x = 'able was i ere i saw elba' x = 'able was i ere i saw elba' y = 'able was i ere i saw elba'

### Community Treasure Hunt

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

Start Hunting!