Add Two Numbers

Medium · Linked Lists · about 15 minutes

Asked at Amazon, Bloomberg, Microsoft, Google, Meta, Apple.

Two non-negative integers are stored as linked lists with their digits in reverse order (the head is the ones digit). Return their sum as a linked list in the same form. Neither number has leading zeros except the number 0 itself.