Simple java solution


  • 0
    J

    public class Solution {
    public List<Integer> getRow(int rowIndex) {
    List<Integer> list=new ArrayList<Integer>();
    for(int i=0;i<=rowIndex;i++){
    list.add(0,1);
    for(int j=1;j<i;j++){
    list.set(j,list.get(j)+list.get(j+1));
    }
    }
    return list;
    }
    }


Log in to reply
 

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