← 返回 snapchat 的题目列表In-Place Array Reversal Without Extra Memory
类型:online_judge
snapchat
Implement an algorithm that performs in-place array reversal, taking inputs and providing outputs through a single entry function without using extra memory or Python built-in methods.
Input
An integer array nums.
Output
The result of reversing the input array in-place.
Constraints
The array length is between 1 and 10^5.
Example
Input: [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
Input: [2, 4, 6]
Output: [6, 4, 2]
Example
Input
1 2 3 4 5