1580. Shuffle the Array
My accepted Python solution to LeetCode problem 1580, Shuffle the Array, running in 31ms.
- Difficulty: Easy
- Python
- Runtime 31ms
- Memory 12.6MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 31ms, memory 12.6MB, accepted 2025-12-24.
class Solution(object):
def shuffle(self, nums, n):
result = []
for i in range(n):
result.append(nums[i])
result.append(nums[i + n])
return result