프로그래밍 문제풀이/LeetCode 문제풀이
2. Add Two Numbers
이경로
2022. 10. 13. 20:06
difficulty : medium
Problem description
Input is two linked lists representing two positive integers.
Each node means one digit, and nodes are arranged in reverse.
The answer is to output the sum of two integers as a linked list in reverse order which is the same as input.
Solution


i is for digit.
num1 and 2 are for storing two lists as integers.

Convert lists(l1, l2) into integers(num1, num2) and add them.

Divide the sum by ten and store the remainder in the return list.
Repeat this process until the integer becomes a single digit.
Link : https://leetcode.com/problems/add-two-numbers/
Add Two Numbers - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com