[python/연결리스트] leetcode - Add Two Numbers 문제
leetcode 문제 : https://leetcode.com/problems/add-two-numbers/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ num1,num2,total = 0,0,0 i,j = 0,0 while(l1): num1 += l1.val *(10 ** i) i += 1 ..
2022. 4. 20.