# Project Euler 18 test case not working

Tell us what’s happening:
The example test case of the matrix given below expects a return value of 23, which is being returned by the function but the test case is not being passed. The other 2 test cases have passed, indicating the code is correct

``````
function maximumPathSumI(triangle) {
for (let i = triangle.length - 2; i >= 0; i--)
for (let j = 0; j <= i; j++)
triangle[i][j] += (triangle[i+1][j]>triangle[i+1][j+1]) ? triangle[i+1][j]:triangle[i+1][j +1];
return triangle;
}

const testTriangle = [[3, 0, 0, 0],
[7, 4, 0, 0],
[2, 4, 6, 0],
[8, 5, 9, 3]];

console.log(maximumPathSumI(testTriangle));
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Edg/91.0.864.59`

Challenge: Problem 18: Maximum path sum I

Hi, your code is correct but you need to comment out the `//console.log(maximumPathSumI(testTriangle));`

This is because the console.log is interfering with test cases when you run the test you get two times 23 as output in console 1st 23 is from your console.log and second is from the test case due to this collusion 1 test case must have failed.

Just comment the line out and you are good to go.
Happy Coding 1 Like

Thank you so much. Yes that was the issue and the test case passed

Hey @swwayam24 I am having this issue in the 20th question too but removing the console.log() doesn’t rectify it although the return values are correct.

Challenge: Problem 20: Factorial digit sum