Wednesday, December 6, 2023

Advent of Code 2023 - Day 6 - Salesforce Apex

Lot's of ways to approach this, I implemented the iterative approach for part 1, stepping through each variance in the range. 

Part 2 was a much larger range to search against and the iterative approach wouldn't work given CPU limits. Instead I used a binary search to find the low and high ends of the range that meet the criteria, and then find the difference for the possible solutions. 

For fun I also implemented a straight math solution using a quadratic formula. This is by far the fastest solution.  

--- Day 6: Wait For It ---

https://adventofcode.com/2023/day/6

Advent Calendar Progress

Day 06 - Solution

No comments:

Post a Comment