Product of All Values (Set 13)

Easy

Given a non-empty array of small integers nums, return the product of every value.

Product of All Values (Set 13) — the data. This set runs 4 cases: nums holds arrays of 48–48 items, with values from -6 to 7. The hidden cases are the largest of the set.

Example 1

productOfValues()
Input
nums = [4, 6, 6, 3, -3, 0, -2, 2, -2, -4, 6, 3, 6, -5, 0, -6, 6, -3, 1, -1, 5, -1, 6, 6, 5, 5, -1, -3, -3, -3, 3, -2, -3, -2, -4, 7, 6, -2, -4, -1, -2, 7, 2, -6, 5, -3, -2, 5]
Output
0

Why

`productOfValues` returns `0` for this input.

Example 2

productOfValues()
Input
nums = [7, -4, 6, 0, -3, 4, -1, -6, -4, -1, 7, 3, -3, 2, 4, 6, 1, 7, -3, -4, 3, 5, 1, 2, 0, 3, 1, 2, 1, 4, -2, -5, -3, -3, 1, 5, -2, -1, 6, 5, -5, -4, -3, -5, 4, -5, -4, 7]
Output
0

Why

`productOfValues` returns `0` for this input.
Constraints
1 <= nums.length <= 20
-9 <= nums[i] <= 9
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

ArraysMath

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