Double Each Value (Set 1)

Easy

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

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

Example 1

doubleEach()
Input
nums = [-48, 67, 51]
Output
[-96, 134, 102]

Why

`doubleEach` returns `[-96, 134, 102]` for this input.

Example 2

doubleEach()
Input
nums = [20, 68, -58, 65]
Output
[40, 136, -116, 130]

Why

`doubleEach` returns `[40, 136, -116, 130]` 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.