Sum of Squares (Set 3)

Easy

Given an array of integers nums, return the sum of every value squared.

Sum of Squares (Set 3) — the data. This set runs 4 cases: nums holds arrays of 12–19 items, with values from -25 to 25. The hidden cases are the largest of the set.

Example 1

sumOfSquares()
Input
nums = [23, -16, 14, 10, -8, -18, -10, -24, 23, -18, 4, 2, -1, -4, -8, 25]
Output
3724

Why

`sumOfSquares` returns `3724` for this input.

Example 2

sumOfSquares()
Input
nums = [2, 22, -12, 25, -23, 8, 19, 15, 6, 19, 2, 0]
Output
2837

Why

`sumOfSquares` returns `2837` for this input.
Constraints
0 <= nums.length <= 10^4
-100 <= nums[i] <= 100
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

ArraysMath

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