Leaderboard Positions - Part 1: 1781, Part 2: 1152
Hello all! In this puzzle, we are checking if a list of numbers is safe or not according to a these rules:
- The levels are either all increasing or all decreasing.
- Any two adjacent levels differ by at least one and at most three.
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.