Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Square(n) Sum

/*
// Complete the square sum function so that it squares each number passed into 
	it and then sums the results together.
// For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9.
*/

const squareSum = numbers => numbers.reduce((acc, cur) => acc + cur ** 2, 0)

// With love @kouqhar
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #Sum
ADD COMMENT
Topic
Name
9+2 =