Sunday, February 14, 2021

Leetcode everyday: 1470. Shuffle the Array. Easy

public class Solution {
    public int[] Shuffle(int[] nums, int n) {
        var list = new List<int>();

        for (var i = 0; i < n; ++i) {
            list.Add(nums[i]);
            list.Add(nums[n + i]);
        }
        
        return list.ToArray();
    }
}
Source: https://leetcode.com/problems/shuffle-the-array/

No comments:

Post a Comment