We're a place where coders share, stay up-to-date and grow their careers.
A KISS version in typescript...
function greatestProductOfAdjacentPair(arr: number[]): number | undefined { let max: number | undefined; for (let i = arr.length - 2; i >= 0; i--) { max = Math.max(max ?? -Infinity, arr[i] * arr[i + 1]); } return max; }
A KISS version in typescript...