Double Each Value (Set 4)

Easy

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

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

Example 1

doubleEach()
Input
nums = [49, -18, 12, 23, 13, 7, -46, 49, -23, -43, 67, 17, 3, 26, 53, -51, -24, -32, -50, 21, 54, -55, 23, -25, 13]
Output
[98, -36, 24, 46, 26, 14, -92, 98, -46, -86, 134, 34, 6, 52, 106, -102, -48, -64, -100, 42, 108, -110, 46, -50, 26]

Why

`doubleEach` returns `[98, -36, 24, 46, 26, 14, -92, 98, -46, -86, 134, 34, 6, 52, 106, -102, -48, -64, -100, 42, 108, -110, 46, -50, 26]` for this input.

Example 2

doubleEach()
Input
nums = [40, -1, 49, 21, -32, 37, 45, 58, 9, -55, -60, 68, 25, -20, -28, 9, -17, -23, 45, -33, -21]
Output
[80, -2, 98, 42, -64, 74, 90, 116, 18, -110, -120, 136, 50, -40, -56, 18, -34, -46, 90, -66, -42]

Why

`doubleEach` returns `[80, -2, 98, 42, -64, 74, 90, 116, 18, -110, -120, 136, 50, -40, -56, 18, -34, -46, 90, -66, -42]` 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.