-- CodingAP's Advent of Code Hub --

[Back to Hub]

Advent of Code 2024, Day 2

-- Red-Nosed Reports --

Leaderboard Positions - Part 1: 1781, Part 2: 1152

Video Explanation

Hello all! In this puzzle, we are checking if a list of numbers is safe or not according to a these rules:

In part 1, we are given a list of lists, and we need to see how many are safe. A simple check between numbers for both difference and the increasing/decreasing bit holds for that. In part 2, we are given a little buffer and we can remove one element to try and make the list safe. Because the lists given are already short, we can just go through all possible lists and check if any of the are safe; if one is, then we can consider the entire list safe.