Skip to content

Instantly share code, notes, and snippets.

@viniciusarre
Last active March 11, 2021 00:42
Show Gist options
  • Select an option

  • Save viniciusarre/7c0e7c4c1ec0a4ef09b10863ca276459 to your computer and use it in GitHub Desktop.

Select an option

Save viniciusarre/7c0e7c4c1ec0a4ef09b10863ca276459 to your computer and use it in GitHub Desktop.
# Shorter solution
def bounded_ratio(a, l, r):
for i, v in enumerate(a):
for x in range(l, r + 1):
yield (i + 1) * x == v
v = (1, 2, 3, 4, 5)
r = l = 1
print(list(bounded_ratio(v, l, r)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment