From d76d3b42ff9750f5460f729e32b181e4c0cbc06d Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Tue, 12 Dec 2017 14:49:56 -0500 Subject: [PATCH] Advent 2017 through Day 12 --- ipynb/Advent 2017.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ipynb/Advent 2017.ipynb b/ipynb/Advent 2017.ipynb index 2fba0e1..d6f964c 100644 --- a/ipynb/Advent 2017.ipynb +++ b/ipynb/Advent 2017.ipynb @@ -1917,7 +1917,7 @@ "\n", "# [Day 12](https://adventofcode.com/2017/day/12): Digital Plumber\n", "\n", - "First I'll parse the data, creating a dict of `{program: direct_group_of_proggrams}`:" + "First I'll parse the data, creating a dict of `{program: direct_group_of_programs}`:" ] }, { @@ -2004,12 +2004,12 @@ "\n", "**Part Two**\n", "\n", - "I did almost all the work; I just need to count the unique groups. The minimum value in a group uniquely identifies it, so:" + "I did almost all the work; I just need to count the number of distinct groups. That's a set of sets, so I have to use my `Set` class (because regular `set`s are not hashable):" ] }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 56, "metadata": { "collapsed": false }, @@ -2020,13 +2020,13 @@ "221" ] }, - "execution_count": 53, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "len({min(G[i]) for i in G})" + "len({Set(G[i]) for i in G})" ] } ],