leetcode/include/s0002_add_two_numbers.hpp

26 lines
672 B
C++
Raw Permalink Normal View History

2022-03-12 03:04:49 +00:00
#ifndef S0002_ADD_TWO_NUMBERS_HPP
#define S0002_ADD_TWO_NUMBERS_HPP
2022-03-10 12:25:55 +00:00
2023-01-30 12:17:47 +00:00
#include "structures.hpp"
2022-03-10 12:25:55 +00:00
2022-11-30 10:20:36 +00:00
class S0002 {
2022-03-10 12:25:55 +00:00
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