MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Correct

32Size

Leading solution size is 10.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test

Code Input and Output

1

Pass

%% x = 1; y_correct = 1; assert(isequal(reverse(x),y_correct))

j = 1 y = 1

2

Pass

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

j = 12 y = 1 j = 11 y = 1 0 j = 10 y = 1 0 -1 j = 9 y = 1 0 -1 -2 j = 8 y = 1 0 -1 -2 -3 j = 7 y = 1 0 -1 -2 -3 -4 j = 6 y = 1 0 -1 -2 -3 -4 -5 j = 5 y = 1 0 -1 -2 -3 -4 -5 -6 j = 4 y = 1 0 -1 -2 -3 -4 -5 -6 -7 j = 3 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 j = 2 y = 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 j = 1 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(reverse(x),y_correct))

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