# My java solution

• ``````      import java.util.*;
public class Solution{
public int minimumTotal(List<List<Integer>> triangle) {
if(triangle .size() == 0)
return 0;

if(triangle.size() == 1)
{
int result=0;
List<Integer> l = new ArrayList();
l=triangle.get(0);

for(int i=0;i<l.size();i++)
{
result = result<l.get(i)?result:l.get(i);
}

return result;
}

ArrayList<ArrayList<Integer>> list = new ArrayList();
//base case
ArrayList<Integer> l0 = new ArrayList<Integer> ();

for(int i=1;i<triangle.size();i++)
{
ArrayList<Integer> tmp = new ArrayList();
for(int j=0;j<triangle.get(i).size();j++)
{
if(j == 0)
{
}

else if(j == triangle.get(i).size()-1)
{
}

else
{
int min = getMinValue(list.get(i-1).get(j),list.get(i-1).get(j-1));
}
}
}
ArrayList<Integer> resList = list.get(triangle.size()-1);

int result = resList.get(0);

for(int i=0;i<resList.size();i++)
{
result = result<resList.get(i)?result:resList.get(i);
}
return result;
}

public int getMinValue(int a, int b)
{
return a>b?b:a;
}
``````

}

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