Cody

Problem 233. Reverse the vector

Solution 2165741

Submitted on 19 Mar 2020 by Lucía Honrubia Fernández
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))

b = 1

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

b = 1 b = 1 0 b = 1 0 -1 b = 1 0 -1 -2 b = 1 0 -1 -2 -3 b = 1 0 -1 -2 -3 -4 b = 1 0 -1 -2 -3 -4 -5 b = 1 0 -1 -2 -3 -4 -5 -6 b = 1 0 -1 -2 -3 -4 -5 -6 -7 b = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 b = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 b = 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))

b = 'a' b = 'ab' b = 'abl' b = 'able' b = 'able ' b = 'able w' b = 'able wa' b = 'able was' b = 'able was ' b = 'able was i' b = 'able was i ' b = 'able was i e' b = 'able was i er' b = 'able was i ere' b = 'able was i ere ' b = 'able was i ere i' b = 'able was i ere i ' b = 'able was i ere i s' b = 'able was i ere i sa' b = 'able was i ere i saw' b = 'able was i ere i saw ' b = 'able was i ere i saw e' b = 'able was i ere i saw el' b = 'able was i ere i saw elb' b = 'able was i ere i saw elba'

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!