function solution(land) {
for (let i = land.length - 2; i >= 0; i--) {
const currentLine = land[i];
const nextLine = land[i + 1];
currentLine.forEach((num, idx) => {
let max = 0;
for (let j = 0; j < nextLine.length; j++) {
if (j == idx) continue;
if (nextLine[j] > max) {
max = nextLine[j];
}
}
land[i][idx] += max;
});
}
return Math.max(...land[0]);
}