Double Each Value (Set 8)

Easy

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

Double Each Value (Set 8) — the data. This set runs 4 cases: nums holds arrays of 29–48 items, with values from -60 to 70. The hidden cases are the largest of the set.

Example 1

doubleEach()
Input
nums = [6, 4, 64, 41, -3, 23, -14, 62, 39, 44, 43, 4, 60, -25, 19, 47, -29, -36, 44, -37, -32, 20, 36, -40, -24, 31, -54, -43, -52]
Output
[12, 8, 128, 82, -6, 46, -28, 124, 78, 88, 86, 8, 120, -50, 38, 94, -58, -72, 88, -74, -64, 40, 72, -80, -48, 62, -108, -86, -104]

Why

`doubleEach` returns `[12, 8, 128, 82, -6, 46, -28, 124, 78, 88, 86, 8, 120, -50, 38, 94, -58, -72, 88, -74, -64, 40, 72, -80, -48, 62, -108, -86, -104]` for this input.

Example 2

doubleEach()
Input
nums = [-55, 38, -46, -15, 61, -39, 34, -40, -29, 62, 32, 34, -26, -55, -9, -38, 8, -37, -21, -5, -51, 20, -15, 23, 40, -56, 0, 58, -15, 1, -47]
Output
[-110, 76, -92, -30, 122, -78, 68, -80, -58, 124, 64, 68, -52, -110, -18, -76, 16, -74, -42, -10, -102, 40, -30, 46, 80, -112, 0, 116, -30, 2, -94]

Why

`doubleEach` returns `[-110, 76, -92, -30, 122, -78, 68, -80, -58, 124, 64, 68, -52, -110, -18, -76, 16, -74, -42, -10, -102, 40, -30, 46, 80, -112, 0, 116, -30, 2, -94]` 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.