lc-go/solutions/14/q1470/solution.go

15 lines
314 B
Go

// Package q1470 implements a solution for https://leetcode.com/problems/shuffle-the-array/
package q1470
func shuffle(nums []int, n int) []int {
ret := make([]int, n*2)
for i, num := range nums[:n] {
ret[i*2] = num
}
for i, num := range nums[n : n*2] {
ret[i*2+1] = num
}
return ret
}
var _ = shuffle