Advent of Code 2023 - Day 6

This is a thread to discuss Day 6

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

REMEMBER!
It is VERY important NOT to write any public spoilers :slight_smile:
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

image

Good luck :slight_smile:
FYI one of the features of Advent of Code is that we all get given different inputs so our answers will be different.
The examples are all the same but each of us gets different inputs for us to solve

Who decided the time would be measured in milliseconds? That is no time at all, and you'd need to be very precise about the amount of time held pressing a button.

Alright the realism rant is over, now it's time to actually give my solution.

Part 1

I took a different approach to finding the solution this time. I noticed a pattern, and thought about it in a mathematical way. It just looks for the minimum number of milliseconds held, then it just finds the max by doing
((total - (min) * 2) - 1))

simple math, no programming required, really

All you need to do is solve a quadratic equation. You could even use a simple calculator.

I've got back on the horse after giving Day 5 a miss and I found Part 1 relatively easy :slight_smile:

And I even managed to use Pipe correctly

Part 1 scripts

aoc23Day6 script pic

Managed to do Part 2 but browser locked up when saving :frowning: but here are my 2 gold stars to prove it

image

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=aoc23Day6