java recurisve


  • -1
    P

    public class Solution {
    public List<Integer> getRow(int rowIndex) {
    List<Integer> temping = new ArrayList<Integer>();
    if(rowIndex == 0)
    {
    temping.add(1);
    return temping;
    }
    temping.add(1);
    List<Integer> temp = getRow(rowIndex - 1);
    for(int i = 0;i<rowIndex - 1;i++)
    {
    temping.add(temp.get(i)+temp.get(i+1));
    }
    temping.add(1);
    return temping;
    }
    }


Log in to reply
 

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