Given an array of integers nums, return the sum of every value squared.
Sum of Squares (Set 2) — the data. This set runs 4 cases: nums holds arrays of 7–16 items, with values from -22 to 30. The hidden cases are the largest of the set.
Example 1
sumOfSquares()
Input
nums =[26,8,-17,13,6,-11,26,30,-4,1,-22,9]
Output
3513
Why
`sumOfSquares` returns `3513`forthisinput.
Example 2
sumOfSquares()
Input
nums =[0,-20,25,11,6,5,-18]
Output
1531
Why
`sumOfSquares` returns `1531`forthisinput.
Constraints
0<=nums.length<=10^4-100<= nums[i]<=100
Every caseinthisset 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.