Skip to content

Commit

Permalink
Day 12 part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitpas committed Dec 12, 2023
1 parent b164186 commit 378b318
Show file tree
Hide file tree
Showing 4 changed files with 1,071 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,12 @@ Part 2:To find the points which are inside or outside, we can count the number o

Part 1: In the previous example, to store the map, I hesitated between using a two dimensional array or a map of the coordinates to the point at the location. Here as the galaxies are quite sparsed, it makes sense to only keep the coordinates. That will also help when 'expanding' the empty spaces.

Part 2: Here to store the larger coordinates I used Long instead of Int. The expansion coefficient was relatively easy to add
Part 2: Here to store the larger coordinates I used Long instead of Int. The expansion coefficient was relatively easy to add

## Day 12

Part 1: I'm going to initially generate all the possible combinations and filter them. There may be a smarter way but let's see if that works.

Part 2: The brute force solution did work for part 1 with only a few seconds way but it is not going to work obviously for part 2. While working on part 1 I thought of a pre-filtering that should keep the number of combinations under control.

Basically, no need to keep the combinations where the number of contiguous '#' is higher than any groups in the expected counts.
Loading

0 comments on commit 378b318

Please sign in to comment.