Hi,

Below is the code I have written in order to solve problem 18.

While it works for smaller test array, it is returning 1064 for the bigger array (1074 is the correct answer)

Path taken by this function for bigger array is (

75

95

47

87

82

75

73

28

83

47

43

73

91

67

98)

```
function maximumPathSumI(triangle,i=0,j=0) {
let sum=0
let temp=[]
let max=0
while(i<triangle.length){
temp=triangle[i].slice(j,j+2)
max=Math.max(...temp)
sum+=max
j=j+temp.indexOf(max)
i++
console.log(j,i,max)
}
console.log(sum)
return sum;
}
const testTriangle = [[3, 0, 0, 0],
[7, 5, 0, 0],
[2, 4, 6, 0],
[8, 7, 9, 3]];
console.log(maximumPathSumI(testTriangle));
```

```
**Your browser information:**
```

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0`

**Challenge:** Problem 18: Maximum path sum I

**Link to the challenge:**