Last active
December 7, 2023 01:15
-
-
Save mhubig/11ab76f304c5f54e338be1c8989d67af to your computer and use it in GitHub Desktop.
Solution for part 2 of day 6 of AOC-2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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