Skip to content

Instantly share code, notes, and snippets.

@mhubig
Last active December 7, 2023 01:15
Show Gist options
  • Save mhubig/11ab76f304c5f54e338be1c8989d67af to your computer and use it in GitHub Desktop.
Save mhubig/11ab76f304c5f54e338be1c8989d67af to your computer and use it in GitHub Desktop.
Solution for part 2 of day 6 of AOC-2023
package main
func calculateWinningStrategies(time, dist int) (strategies int) {
for i := 1; i <= time; i++ {
if (time-i)*i > dist {
strategies++
}
}
return strategies
}
func main() {
println("Result:", calculateWinningStrategies(40828492, 233101111101487))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment