Skip to content

Instantly share code, notes, and snippets.

@nhuntwalker
Created December 7, 2017 17:33
Show Gist options
  • Save nhuntwalker/e914641582924aa5657bd8d77c9fceb8 to your computer and use it in GitHub Desktop.
Save nhuntwalker/e914641582924aa5657bd8d77c9fceb8 to your computer and use it in GitHub Desktop.
Add Linked Lists of Numbers
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1's digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list.
Ex:
438 + 123 = 561
[ 8 ] -> [ 3 ] -> [ 4 ]
+
[ 3 ] -> [ 2 ] -> [ 1 ]
=
[ 1 ] -> [ 6 ] -> [ 5 ]
email to nicholas@codefellows.com by 10am
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment