func generate(numRows int) [][]int {
var rows [][]int
for i := 0; i < numRows; i++ {
row := make([]int, i + 1)
for j := 0; j <= i; j++ {
if j == 0 || j == i {
row[j] = 1
} else {
prevRow := rows[i - 1]
row[j] = prevRow[j] + prevRow[j - 1]
}
}
rows = append(rows, row)
}
return rows
}