@@ -0,0 +1,682 @@
+import java.util.ArrayList;%0A%0A/**%0A * http://leetcode.com/onlinejudge#question_118%0A * %0A */%0Apublic class PascalTriangle %7B%0A%09public ArrayList%3CArrayList%3CInteger%3E%3E generate(int numRows) %7B%0A%09%09ArrayList%3CArrayList%3CInteger%3E%3E result = new ArrayList%3CArrayList%3CInteger%3E%3E();%0A%09%09if (numRows == 0) %7B%0A%09%09%09return result;%0A%09%09%7D else %7B%0A%09%09%09for (int row = 0; row %3C numRows; row++) %7B%0A%09%09%09%09ArrayList%3CInteger%3E rowResult = new ArrayList%3CInteger%3E();%0A%09%09%09%09rowResult.add(1);%0A%09%09%09%09for (int col = 0; col %3C row - 1; col++) %7B%0A%09%09%09%09%09rowResult.add(result.get(row - 1).get(col) + result.get(row - 1).get(col + 1));%0A%09%09%09%09%7D%0A%09%09%09%09if (row %3E 0) %7B%0A%09%09%09%09%09rowResult.add(1);%0A%09%09%09%09%7D%0A%09%09%09%09result.add(rowResult);%0A%09%09%09%7D%0A%09%09%09return result;%0A%09%09%7D%0A%09%7D%0A%7D%0A

question_118