@@ -0,0 +1,1130 @@
+/***%0A * Given numRows, generate the first numRows of Pascal's triangle.%0A *%0A * For example, given numRows = 5,%0A * Return%0A *%0A * %5B%0A *      %5B1%5D,%0A *     %5B1,1%5D,%0A *    %5B1,2,1%5D,%0A *   %5B1,3,3,1%5D,%0A *  %5B1,4,6,4,1%5D%0A * %5D%0A */%0Aimport java.util.ArrayList;%0A%0Apublic class Solution %7B%0A    public ArrayList%3CArrayList%3CInteger%3E%3E generate(int numRows) %7B%0A        if (numRows == 0)%0A            return new ArrayList%3CArrayList%3CInteger%3E%3E();%0A        ArrayList%3CArrayList%3CInteger%3E%3E ret = new ArrayList%3CArrayList%3CInteger%3E%3E();%0A        ArrayList%3CInteger%3E level = new ArrayList%3CInteger%3E();%0A        level.add(1);%0A        while (numRows-- != 0) %7B%0A            ArrayList%3CInteger%3E newlevel = new ArrayList%3CInteger%3E(level);%0A            ret.add(newlevel);%0A            level = generateNext(level);%0A        %7D%0A        return ret;%0A    %7D%0A%0A    private ArrayList%3CInteger%3E generateNext(ArrayList%3CInteger%3E level) %7B%0A        ArrayList%3CInteger%3E newlevel = new ArrayList%3CInteger%3E();%0A        newlevel.add(1);%0A        for (int i = 0; i %3C level.size() - 1; i++)%7B%0A            newlevel.add(level.get(i) + level.get(i + 1));%0A        %7D%0A        newlevel.add(1);%0A        return newlevel;%0A    %7D%0A%7D%0A

add PascalsTriangle.java