Aaron's Page

This is where I post about what I'm working on.

--- Day 9: Smoke Basin ---

or..

Smoke Underwater - A misheard Deep Purple song title.

one art please

Part 1

Python

I solved this using look-arounds bounded by input data size. I screwed at least once by using my index as a comparison value instead of as, well, an index... /facepalm. There really wasn't anything special about what I did for this challenge, it just took a while to set up the conditions.

Go

Still catching up

Part 2

Python

What ended up taking me the longest time on this was determining how to maintain my loop exploring a basin size while expanding on the known coordinates on the basin and also not doubling up on coordinates.

My final methodology ended up being:

  1. Use part 1 to find all of the lows, but store the coordinates as a tuple
  2. Pass my and each low coordinate into a separate function that:
  3. added the initial (coord) to a list of coordinates
  4. initialized an index at 0
  5. performed the same basic look-around from part 1 but for the coordinate at the index.
  6. if the value(s) found were not 9, their (coord) was added to coords
  7. i was incremented and checked against the length of coords
  8. once i reached the length of coords, it meant we were a) through all of the coords that have been added and b) no longer adding new (coord)
  9. returned the length of the basin
  10. Once we had the full list of basins, I sorted it and returned the value of the -1,-2,-3 indexes multiplied together.

Not too terrible, honestly.

Go

We'll see.

<< - Table of Contents - >>