class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if not l1 and not l2:
return None
a = 0
b = 0
l3 = ListNode(0)
while l1:
a = a*10 + l1.val
l1 = l1.next
while l2:
b = b*10 + l2.val
l2 = l2.next
c = a + b
cur = l3
for s in str(c):
cur.next = ListNode(int(s))
cur = cur.next
return l3.next
class Solution(object):
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
res = [1]*(rowIndex+1)
for i in range(2,rowIndex+1):
for j in range(i-1,0,-1):
res[j] += res[j-1]
return res