Skip to content

Instantly share code, notes, and snippets.

@rao107
Created June 17, 2022 21:57
Show Gist options
  • Save rao107/16dedc09e14c91936d7ff389af642677 to your computer and use it in GitHub Desktop.
Save rao107/16dedc09e14c91936d7ff389af642677 to your computer and use it in GitHub Desktop.
Code for Riddler Classic on 6/17/22
def riddler_classic():
max_prob = 0
max_n = 0
for n in range(11, 100):
prob = 1
for i in range(0, 8):
prob *= (n - i) / (2 * n - i)
for i in range(0, 11):
prob *= (n - i) / (2 * n - 8 - i)
if prob > max_prob:
max_prob = prob
max_n = n
print("The original number of balls is", 2 * max_n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment