Add Two Numbers II

Medium · Linked Lists · about 20 minutes

Asked at Microsoft, Amazon, Bloomberg, Pinterest, Meta.

Two non-negative integers are stored as linked lists with the most significant digit first. Return their sum as a linked list in the same form. Neither number has leading zeros, except 0 itself. Try not to reverse the input lists.