mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 09:58:03 +00:00
Fix typos (#191)
This commit is contained in:
committed by
Donne Martin
parent
cd9e9654bc
commit
9f89a51aba
@@ -74,7 +74,7 @@
|
||||
"source": [
|
||||
"## Algorithm\n",
|
||||
"\n",
|
||||
"We'll use a recursive solution that valides left <= current < right, passing down the min and max values as we do a depth-first traversal.\n",
|
||||
"We'll use a recursive solution that validates left <= current < right, passing down the min and max values as we do a depth-first traversal.\n",
|
||||
"\n",
|
||||
"* If the node is None, return True\n",
|
||||
"* If min is set and the node's value <= min, return False\n",
|
||||
@@ -123,12 +123,12 @@
|
||||
" raise TypeError('No root node')\n",
|
||||
" return self._validate(self.root)\n",
|
||||
"\n",
|
||||
" def _validate(self, node, mininum=-sys.maxsize, maximum=sys.maxsize):\n",
|
||||
" def _validate(self, node, minimum=-sys.maxsize, maximum=sys.maxsize):\n",
|
||||
" if node is None:\n",
|
||||
" return True\n",
|
||||
" if node.data <= mininum or node.data > maximum:\n",
|
||||
" if node.data <= minimum or node.data > maximum:\n",
|
||||
" return False\n",
|
||||
" if not self._validate(node.left, mininum, node.data):\n",
|
||||
" if not self._validate(node.left, minimum, node.data):\n",
|
||||
" return False\n",
|
||||
" if not self._validate(node.right, node.data, maximum):\n",
|
||||
" return False\n",
|
||||
|
||||
Reference in New Issue
Block a user