Given an array of integers nums, return the sum of every value squared.
Sum of Squares (Set 1) — the data. This set runs 4 cases: nums holds arrays of 5–9 items, with values from -24 to 29. The hidden cases are the largest of the set.
Example 1
sumOfSquares()
Input
nums =[-19,-2,16,20,25]
Output
1646
Why
`sumOfSquares` returns `1646`forthisinput.
Example 2
sumOfSquares()
Input
nums =[29,6,6,-1,28,23,-12,24]
Output
2947
Why
`sumOfSquares` returns `2947`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.