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
|
2198 Discussions
|
Please Login in order to post a comment
public static List reverseArray(List a) { ArrayList list=new ArrayList<>(a); Collections.reverse(list); return list; }
**JavaScript------* Stack----
JavaScript:
def reverseArray(a): return a[::-1]
def reverseArray(a): reversed_list = [] for i in range(len(a)): reversed_list.append(a[len(a) - 1 - i]) return reversed_list