leetcode/include/s0002_add_two_numbers.hpp

26 lines
672 B
C++

#ifndef S0002_ADD_TWO_NUMBERS_HPP
#define S0002_ADD_TWO_NUMBERS_HPP
#include "structures.hpp"
class S0002 {
public:
/**
* @brief Add Two Numbers
*
* You are given two **non-empty** linked lists representing two non-negative
* integers. The digits are stored in **reverse order**, and each of their
* nodes contains a single digit. Add the two numbers and return the sum as a
* linked list.
*
* You may assume the two numbers do not contain any leading zero, except the
* number 0 itself.
*
* @param l1 the first linked list
* @param l2 the second linked list
*/
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2);
};
#endif