Hackerrank - Arrays - DS solution

Problem link

Solution one:

Using Python’s default syntax.

def reverseArray(a):
    return a[::-1]

Solution two:

Looping from the last item and storing it in an array.

def reverseArray(a):
    temp = []

    for i in range(len(a)-1, -1, -1):

    return temp

Solution three:

Swap the items until we reach the middle of the array.

def reverseArray(a):
    s = len(a)
    for i in range(s//2):
        a[i], a[s-i-1] = a[s-i-1], a[i]
    return a