+ 4

Challenge reverse an array

Write a custom function to reverse an array. Print the array before and after you reverse it. For example : Input : {1,2,3,4,5} Output : {5,4,3,2,1} Keep it simple and have fun!

17th Feb 2018, 4:57 PM
Nitzan
Nitzan - avatar
7 Answers
+ 7
Python : a[::-1]
17th Feb 2018, 4:58 PM
VcC
VcC - avatar
18th Feb 2018, 10:48 AM
r8w9
r8w9 - avatar
+ 5
https://code.sololearn.com/cbaelxdi1fYO/?ref=app
17th Feb 2018, 9:39 PM
Boris Batinkov
Boris Batinkov - avatar
17th Feb 2018, 4:58 PM
Nitzan
Nitzan - avatar
+ 1
https://code.sololearn.com/cKHyqTsvuYsE/?ref=app
18th Mar 2018, 12:21 PM
...
0
I can do it easily with ruby: arr=[1,2,3,4,5,6] res=arr.reverse print res fake=gets
18th Feb 2018, 9:04 AM
asd