public static int minimumTotal(List<List<Integer>> triangle) {//AC
        int layer = triangle.size();
        int temp[] = new int[layer];
        for (int i = 0; i < layer; ++i) {
            temp[i] = triangle.get(layer-1).get(i);
        }
        for (int i = layer-1; i > 0; --i) {
            List<Integer> l1 = triangle.get(i-1);
            for (int j = 0; j < l1.size(); ++j) {
                temp[j] = Math.min(temp[j], temp[j+1]) + l1.get(j);
            }
        }
        return temp[0];
    }