Day 1 - Advent of Code 2022 Hints
Sum each Elf’s Calories and compare.
- Parse the input to extract the Calories of each food item.
- For each Elf, sum the Calories of the food items they are carrying.
- Compare the total Calories carried by each Elf, and output the Elf carrying the most Calories and the number of Calories they are carrying.
- If a blank line is encountered, this indicates the end of the current Elf’s inventory and the start of the next Elf’s inventory. In this case, store the current Elf’s total Calories in a separate variable or data structure, and reset the current Elf’s total Calories to 0.
- Keep a list of the total Calories for each Elf, and add the Calories of each food item to the appropriate Elf’s total.
- The top three Elves with the most Calories can be found by sorting the list of total Calories in descending order and taking the first three values.
- To find the total Calories carried by the top three Elves, sum the Calories of the top three Elves.