2025-08-03 10:42:44 +0000 UTC

Shuffle the Array

Code

class Solution:
    def shuffle(self, nums: List[int], n: int) -> List[int]:
        res = []
        for j in range(n, 2 * n):
            res.extend((nums[j - n], nums[j]))
        return res