# Triangle question, why this answer is wrong?

• The question is located at: https://leetcode.com/problems/triangle/

Here is my solution:

``````public class Solution {
public int minimumTotal(List<List<Integer>> triangle) {

//loop the triangle list
int total = 0;
for (List<Integer> list : triangle){
total += Collections.min(list);
//System.out.println(total);
}
return (int)total;
}
}
``````

The test case was: [[-1],[2,3],[1,-1,-3]]

Wouldn't the smallest path be -1 + 2 + (-3) = -2

Why is the expected answer is -1 ? Did I miss something very obvious?

• facing the same issue

• This post is deleted!

• You guys are cute...it means `neighbours` you cannot connect the un-neighbours here, so `list.min` cannot be used here

• @LHearen Could you explain a little more the neighbours and un-neighbours parts?

• @rattanak
`[[1],[2,3],[4,5,6]]` in this case 2 is not the neighbour of 6, but 4 and 5 are its neighbours

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.