Reverse the vector elements.
Example:
Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]
Added some more tests.
Test set needs a column vector.
As far as timing goes ...
x=rand(100,1);
tic;y=flipud(x);toc
Elapsed time is 0.068947 seconds.
tic;y=x(end:-1:1);toc
Elapsed time is 0.000026 seconds.
innovative
This link can help:
https://in.mathworks.com/help/matlab/ref/fliplr.html
I did it!
(^^)v
gj
Errors in the test suite.
This user (mohamed elbesealy) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
Never knew about rot90. I did, y = x(length(x):-1:1) and the size was 19! Learnt something new..
That was easy
we had a similar problem in my class
easy one
how to make the code even shorter than this???
helpfull!
Test set needs a column vector.
Return a list sorted by number of occurrences
1225 Solvers
Calculate the Levenshtein distance between two strings
303 Solvers
Back to basics 23 - Triangular matrix
532 Solvers
How many trades represent all the profit?
460 Solvers
166 Solvers