Implement a function squareSum so that it squares any number(s) passed into it and then adds the squares together.
For example, for [1, 2, 2]: it ...
For further actions, you may consider blocking this person and/or reporting abuse
Javascript:
Trying to find a more... unconventional javascript answer :D
you can actually get rid of the
map
I am in love with Python.
Btw, you gave "tests" but the tests don't have the supposed results. I know I can hand calculate but still they are not complete test cases.
Point free baby!
(Obviously this is probably too polymorphic, you could just limit it to
[Int] -> Int
)Sum of squares is the default example of the Rayon crate:
(this runs in parallel)
Apparently people here are really into onelinerization.
No parallelism, but at least it's shorter than Python.
Elm
I really wish flip is part of the core library...
My swift solution :
Python
Elixir
JS:
Kotlin