1470. Shuffle the Array

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1470

class Solution:
    def shuffle(self, nums: List[int], n: int) -> List[int]:
        nums[::2], nums[1::2] = nums[:n], nums[n:]
        return nums