```
import java.util.*;
public class Solution {
public int minimumTotal(List<List<Integer>> triangle) {
int size = triangle.size();
int ways = (int)Math.pow(2, size-1);
int globalMin = Integer.MAX_VALUE;
int counter = ways-1;
int bitLength =size-1;
for(int i = counter;i>=0;i--){
int tempSum=triangle.get(0).get(0);
for(int j = 0;j<=bitLength-1;j++){
if((counter&(1<<j))==1){
tempSum += triangle.get(j+1).get(j+1);
}else{
tempSum += triangle.get(j+1).get(j);
}
}
if(tempSum<globalMin){
globalMin = tempSum;
}
counter--;
}
return globalMin;
}
}
```