A Gift Well Spent
PreviousEvery possible sum of two digitsNextExclamation marks series #3: Remove all exclamation marks from sentence except at the end
Last updated
Was this helpful?
Last updated
Was this helpful?
if the input array is empty return null
copy input array through 'slice(0)' and reducing for compare
Find the index of the value that satisfies (x-acc) in the value of the right array, that is, an array of n+1 or greater.
for that array.slice(i).indexOf(x - acc) + i
if there is no answer in process-2, will return last elements of array so if result.length is not equal 2 we didn't found result so should be return null, if result.length equals 2. return elements