@@ -0,0 +1,646 @@
+/**%0A * Generate and return the first n rows of pascal's triangle%0A */%0Apublic class Solution %7B%0A  public List%3CList%3CInteger%3E%3E generate(int n) %7B%0A    List%3CList%3CInteger%3E%3E list = new ArrayList%3CList%3CInteger%3E%3E());%0A    triangle(n, 0, list);%0A    return list;%0A  %7D%0A%0A  public void triangle(int n, int index, List%3CList%3CInteger%3E%3E list) %7B%0A    if (index == n) return;%0A    List%3CInteger%3E cur = new ArrayList%3CInteger%3E();%0A    cur.add(1);%0A    for (int i = 1; i %3C index; i ++) %7B%0A      List%3CInteger%3E above = list.get(index - 1);%0A      cur.add(above.get(i) + above.get(i - 1));%0A    %7D%0A    if (index %3E 0) cur.add(1);%0A    list.add(cur);%0A    triangle(n, index + 1, list);%0A  %7D%0A%7D

Add pascals triangle