Brief Java solution


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

    }


Log in to reply
 

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