mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-03-04 14:48:45 +00:00
Changed discussions of NULL to None to be more Pythonic.
This commit is contained in:
@@ -70,8 +70,8 @@
|
||||
"We could solve this with an iterative or a recursive algorithm, both are well suited for this exercise. We'll use a recursive algorithm for practice with recursion. Note this takes an extra space of O(m) where m is the recursion depth.\n",
|
||||
"\n",
|
||||
"* Base case:\n",
|
||||
" * if first and second lists are NULL AND carry is zero\n",
|
||||
" * Return NULL\n",
|
||||
" * if first and second lists are None AND carry is zero\n",
|
||||
" * Return None\n",
|
||||
"* Recursive case:\n",
|
||||
" * Set `value` to `carry`\n",
|
||||
" * Add both nodes' `data` to `value`\n",
|
||||
@@ -87,7 +87,7 @@
|
||||
"\n",
|
||||
"Notes:\n",
|
||||
"* Careful with adding if the lists differ\n",
|
||||
" * Only add if a node is not NULL\n",
|
||||
" * Only add if a node is not None\n",
|
||||
" * Alternatively, we could add trailing zeroes to the smaller list"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user