C# Solution


  • 0
    M
    public IList<int> GetRow(int rowIndex) {
        int[] arr = new int[rowIndex + 1]; 
        for (int i = 0; i <= rowIndex; i++)
        {
            for (int j = i; j >= 0; j--)
            {
                if (j == i || j == 0) arr[j] = 1;
                else arr[j] = arr[j] + arr[j -1];
            }
        }
        
        return new List<int>(arr); 
    }

Log in to reply
 

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