luoheng
10/7/2019 - 2:25 AM

getRow

func getRow(rowIndex int) []int {
    kLine := make([]int, rowIndex + 1)
    for i := 0; i < rowIndex + 1; i++ {
        kLine[0], kLine[i] = 1, 1
        lastNum := 1
        for j := 1; j < i; j++ {
            lastNum, kLine[j] = kLine[j], kLine[j] + lastNum
        }
    }
    return kLine
}