2022-12-01 13:05:47 +01:00
2022-12-01 13:05:47 +01:00
2022-12-01 13:05:47 +01:00
2022-12-01 13:05:47 +01:00

Advent of Code 2022 - assignment 1

This is the first assignment for Advent of Code 2022. The provided solution uses 3 variables: currentScore, highestCalorieScore, currentElf, highestElf. It is complexity O(n²) since it loops through every line exactly once and the iterates for recalculating highscore.

Solution description

Every iteration the score is added to the currentScore. If an empty line is detected we check if currentscore exceeds one of our highestCalorieScore, if yes we assign currentElf to highestElf.

references

Description
Advent of Code assignments
Readme 358 KiB
Languages
JavaScript 52.2%
HTML 26.4%
CSS 21.4%