We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Data Structures
- Arrays
- Arrays - DS
- Discussions
Arrays - DS
Arrays - DS
Sort by
recency
|
2207 Discussions
|
Please Login in order to post a comment
def reverseArray(a): # Write your code here r=a[::-1] return r
Java 7 Solution
Sometimes i forget some function can turn it much more simple. Here is in Java 8
vector reverseArray(vector a) {
}
left, right = 0, len(arr) - 1 while left < right: arr[left], arr[right] = arr[right], arr[left] left += 1 right -= 1 return arr