Noticeably, the rowIndex follows **zero-based numbering**.

Each row shares the same pattern that the first and last elements are `1`

's, and elements in the middle are the addition of adjacent pairs in one row before.

```
def getRow(self, rowIndex):
pend = [1]
for i in xrange(rowIndex):
pend = [1] + [pend[k] + pend[k+1] for k in xrange(len(pend) - 1)] + [1]
return pend
```