A Teacher looks at Advent of Code 2016 #2

Today we're looking at Advent of Code 2016 number 2.

To change things up, I thought I'd do a video where I live code a solution.

The solution I present is pretty straightforward - use a 2D array (or technically, an array of strings) to represent the keypad, parse the input, and follow the input instructions to build the code.

One of the things I really like about Advent of Code is that every problem has two parts and depending on how you solved part 1, you may or may not have extra work to do for part 2.

A couple of years ago, I wrote about one of the coding techniques I try to convey to my students. The idea of changing the data to take away edge and special cases.

Part two of this problem is a perfect time to use that technique.

Here's the video, I hope you enjoy it:

Comments

Comments powered by Disqus

Enter your email address:

Delivered by FeedBurner

Google Analytics Alternative