LeetCode solutions

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

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 31ms, memory 12.6MB, accepted 2025-12-24.

python
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

Source