/**
* @param {number[]} nums
* @param {number} n
* @return {number[]}
*/
var shuffle = function (nums, n) {
const hash = (i) => i < n ? 2 * i : 2 * (i - n) + 1;
return nums.reduce((results, value, index) => {
results[hash(index)] = value;
return results;
}, new Array(2 * n));
};