Double Each Value (Set 3)

Easy

Given an array of integers nums, return a new array where every value has been multiplied by 2.

Double Each Value (Set 3) — the data. This set runs 4 cases: nums holds arrays of 13–21 items, with values from -57 to 68. The hidden cases are the largest of the set.

Example 1

doubleEach()
Input
nums = [26, -15, -15, -57, 20, -8, 53, -21, -11, 57, -9, 49, 35, 24, -36, 50, -3, -33, 2, -42, -13]
Output
[52, -30, -30, -114, 40, -16, 106, -42, -22, 114, -18, 98, 70, 48, -72, 100, -6, -66, 4, -84, -26]

Why

`doubleEach` returns `[52, -30, -30, -114, 40, -16, 106, -42, -22, 114, -18, 98, 70, 48, -72, 100, -6, -66, 4, -84, -26]` for this input.

Example 2

doubleEach()
Input
nums = [-54, 5, -12, -26, -21, 5, 38, 68, -16, 22, 34, -55, -7]
Output
[-108, 10, -24, -52, -42, 10, 76, 136, -32, 44, 68, -110, -14]

Why

`doubleEach` returns `[-108, 10, -24, -52, -42, 10, 76, 136, -32, 44, 68, -110, -14]` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

Arrays

Implement doubleEach in the editor and return the answer — printing it is never graded.