Cody

Problem 233. Reverse the vector

Solution 769368

Submitted on 31 Oct 2015 by naveen sarigala
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(reverse(x),y_correct))

y = 1 j = 2

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

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

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

y = a j = 2 y = ab j = 3 y = abl j = 4 y = able j = 5 y = able j = 6 y = able w j = 7 y = able wa j = 8 y = able was j = 9 y = able was j = 10 y = able was i j = 11 y = able was i j = 12 y = able was i e j = 13 y = able was i er j = 14 y = able was i ere j = 15 y = able was i ere j = 16 y = able was i ere i j = 17 y = able was i ere i j = 18 y = able was i ere i s j = 19 y = able was i ere i sa j = 20 y = able was i ere i saw j = 21 y = able was i ere i saw j = 22 y = able was i ere i saw e j = 23 y = able was i ere i saw el j = 24 y = able was i ere i saw elb j = 25 y = able was i ere i saw elba j = 26