TypeScript Adjacent Elements Product
function adjacentElementsProduct(inputArray: number[]): number {
let max = -Infinity;
for (let i = 0; i < inputArray.length - 1; i++) {
max = Math.max(max, inputArray[i] * inputArray[i + 1]);
}
return max;
}
This walks through neighboring values, multiplies each pair, and keeps the biggest product it finds.