blob: d7015434bc0a1acc1efc9f033b37f5fc7199ee1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
See: https://adventofcode.com/2015/day/1
** Part 1
*** Purpose
Given a stream of parenthesis:
#+begin_example
))(((((
#+end_example
We subtract the number of "((" parens from the number of ")))".
*** Method
The solution to this is simple: count the number of each, and perform the subtraction. Given that I already solved part on of this problem before, I will instead immediately design a solution to the problem that also works for part 2. In my attempt months ago, I made the "mistake" of not using a loop :):
** Part 2
*** Purpose
Now, we need to calculate the index of the input stream where the cumulative number is first zero.
*** Method
The above information reveals that a solution that would work for both parts is a simple loop structure.
|