# LeetCode Add Two Numbers: Simulate Addition With Linked List

## Overview

LeetCode Add Two Numbers is a direct simulation of addition, be careful about the carry which could be added into the more significant digit.

## LeetCode Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8

## Analysis: Simulate Addition With Linked List

There is no tricky algorithm involved in this problem. The solution is straightforward by directly simulation of addition. The only things need to be kept in our mind is the following cases:

1.   4->NULL + 6->NULL == 0->1->NULL
2.   1-NULL + 9->9->9->NULL == 0->0->0->1->NULL

The following code is accepted by LeetCode OJ to pass this Add Two Numbers problem:

## Summary

LeetCode Add Two Numbers is a direct simulation of addition, be careful about the carry which could be added into the more significant digit.

Written on January 16, 2015