From 47e34b10dd651ac0656c6fcaace82471a9e71657 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Sun, 12 Jun 2016 23:22:27 -0400 Subject: [PATCH] Polish find loop start challenge and solution Change slow and fast nodes equality check from their data value to an object check. --- .../find_loop_start/find_loop_start_challenge.ipynb | 10 +++++----- .../find_loop_start/find_loop_start_solution.ipynb | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/linked_lists/find_loop_start/find_loop_start_challenge.ipynb b/linked_lists/find_loop_start/find_loop_start_challenge.ipynb index d6065fa..11073e9 100644 --- a/linked_lists/find_loop_start/find_loop_start_challenge.ipynb +++ b/linked_lists/find_loop_start/find_loop_start_challenge.ipynb @@ -186,21 +186,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.10" + "pygments_lexer": "ipython3", + "version": "3.5.0" } }, "nbformat": 4, diff --git a/linked_lists/find_loop_start/find_loop_start_solution.ipynb b/linked_lists/find_loop_start/find_loop_start_solution.ipynb index 102d927..5bdf2ec 100644 --- a/linked_lists/find_loop_start/find_loop_start_solution.ipynb +++ b/linked_lists/find_loop_start/find_loop_start_solution.ipynb @@ -111,10 +111,10 @@ " fast = fast.next.next\n", " if fast is None:\n", " return None\n", - " if slow.data == fast.data:\n", + " if slow == fast:\n", " break\n", " slow = self.head\n", - " while slow.data != fast.data:\n", + " while slow != fast:\n", " slow = slow.next\n", " fast = fast.next\n", " if fast is None:\n", @@ -238,7 +238,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3" + "version": "3.5.0" } }, "nbformat": 4,