using System.Collections.Generic;
public ListNode(int val = 0, ListNode next = null)
public static ListNode AddTwoNumbers(ListNode l1, ListNode l2)
public static void Main()
Console.WriteLine("Starting");
var result = AddTwoNumbers(c.a, c.b);
bool same = VerifyNumbers(result, c.res);
PrintResults(result, c.res, same);
Console.WriteLine("Finished");
public static void PrintResults(ListNode actual, ListNode expected, bool same)
Stack<int> rev = new Stack<int>();
Console.Write(val.ToString());
Stack<int> rev = new Stack<int>();
Console.Write(val.ToString());
public static bool VerifyNumbers(ListNode actual, ListNode expected)
public static List<TestCase> GetCases()
var cases = new List<TestCase>();
cases.Add(new TestCase(new List<int>{3, 4, 2}, new List<int>{4, 6, 5}, new List<int>{8, 0, 7}));
private static ListNode BuildList(List<int> nums)
foreach (var num in nums)
res = new ListNode(num, res);
public TestCase(List<int> term_a, List<int> term_b, List<int> sum)