Project Euler: Problem 18 // does first test pass?

I’ve attempted this multiple times, I also console.log() my value I’m returning to ensure that I’m getting the correct answer and the first test {maximumPathSumI(testTriangle) should return 23} isn’t passing. I’m able to pass the second test no problem.
For the first test on the chrome browser console, it shows the correct answer but as soon as I hit run to test it returns the wrong value;


Had the same problem. In my algorithm I was mutating the array that came in from parameters and as I had a console.log statement for the testArray by the time the test got it the array had been mutated. I suspect you were doing a similar thing (popping off the last row once you’d calculated the max sum for each node of the row you’re looking at)

Solution: remove console.log statements or make a copy of the array your function receives and operate on that