Sobes.tech
Junior — Senior

Determining the index of the first pair of neighboring numbers whose digit sum equals 8

livecode

Task condition

It is necessary to implement a function that takes an array of integers and returns the index of the first occurrence of two adjacent elements whose sum of all digits of both numbers is equal to 8. A solution with the smallest possible asymptotic complexity should be chosen.

const numbers = [1, 5, 4, 3, 2, 6]