#include <iostream>
#include <string>
#include <map>
using namespace std;
struct Node
{
int data;
Node* next;
};
Node* addLists(Node* n1, Node* n2, int carry)
{
if (!n1 && !n2 && !carry)
{
return NULL;
}
Node* res;
int value = carry;
if (!n1)
{
value += n1->data;
}
if (!n2)
{
value += n2->data;
}
res->data = value % 10;
Node* more = addLists(n1 == NULL ? NULL : n1->next, n2 == NULL ? NULL : n2->next, value >= 10 ? 1 : 0);
res->next = more;
return res;
}
int main()
{
//getchar();
return 0;
}
#include <string>
#include <map>
using namespace std;
struct Node
{
int data;
Node* next;
};
Node* addLists(Node* n1, Node* n2, int carry)
{
if (!n1 && !n2 && !carry)
{
return NULL;
}
Node* res;
int value = carry;
if (!n1)
{
value += n1->data;
}
if (!n2)
{
value += n2->data;
}
res->data = value % 10;
Node* more = addLists(n1 == NULL ? NULL : n1->next, n2 == NULL ? NULL : n2->next, value >= 10 ? 1 : 0);
res->next = more;
return res;
}
int main()
{
//getchar();
return 0;
}