200 iq python solution


  • 0
    class Solution(object):
        def addTwoNumbers(self, l1, l2):
            """
            :type l1: ListNode
            :type l2: ListNode
            :rtype: ListNode
            """
            
            list_1 = []
            list_2 = []
            
            while l1:
                list_1.append(l1.val)
                l1 = l1.next
            
            while l2:
                list_2.append(l2.val)
                l2 = l2.next
              
            return [int(i) for i in list(str(int(''.join([str(i) for i in list_1][::-1])) + int(''.join([str(i) for i in list_2[::-1]]))))][::-1]

Log in to reply
 

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