summaryrefslogtreecommitdiff
path: root/calorie-counting/README.org
blob: 6d3672fee09070dc451d033d9553ed45472b644f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
See: https://adventofcode.com/2022/day/1
** Part 1
*** Purpose
Given a list of numbers:

#+begin_example
1000
2000
3000

4000

5000
6000

7000
8000
9000

10000
#+end_example

Calculate the "group" with the largest sum, and report that sum.

*** Method

This sounds easy. Split the input into a list of lists:

#+begin_example
'((1000
   2000
   3000)
  (4000
   5000
   6000)
  (7000
   8000
   9000)
  (10000))
#+end_example

Sum up each sub-list, sort it, and take the CAR!

** Part 2
*** Purpose
The next part simply asks us to sum the top 3 numbers. So quick and easy, I've just provided the mechanisms for summing X highest numbers.