diff --git a/day1/solution.ts b/day1/solution.ts index b09b9ce..d6d8671 100644 --- a/day1/solution.ts +++ b/day1/solution.ts @@ -14,4 +14,7 @@ for (const calorieData of rawCalories) { parsedCalories.push(total); } -console.log(Math.max(...parsedCalories)); +parsedCalories = parsedCalories.sort((n1, n2) => n1 - n2); + +console.log(parsedCalories[parsedCalories.length - 1]); +console.log(parsedCalories[parsedCalories.length - 1] + parsedCalories[parsedCalories.length - 2] + parsedCalories[parsedCalories.length - 3]);