Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
The partials map maps the index of each value to the value required to bring it up to the target. This can then be picked up by a later value to the get the answer.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
reduce
is good for this one.Here's a JS quickie with O(n) complexity.
The
partials
map maps the index of each value to the value required to bring it up to the target. This can then be picked up by a later value to the get the answer.