You are given an array of integers nums.
Your task is to return a new array where each element is doubled (multiplied by 2).
You may assume that:
Return the new array with each element doubled. The order of elements must be preserved.
[1, 2, 3]
[2, 4, 6]
Each element is multiplied by 2: 12=2, 22=4, 3*2=6.
[-1, 0, 1]
[-2, 0, 2]
Doubling works for negative numbers and zero as well.
[]
[]
An empty array returns an empty array.
[1, 2, 3]
[2, 4, 6]