Skip to content

Instantly share code, notes, and snippets.

@ryan-kasi
Created December 13, 2020 16:12
Show Gist options
  • Save ryan-kasi/84243102d2ece47119691f256bc906c3 to your computer and use it in GitHub Desktop.
Save ryan-kasi/84243102d2ece47119691f256bc906c3 to your computer and use it in GitHub Desktop.
from functools import reduce
constraints_mapping = [[idx, int(item)] for idx, item in enumerate(constraints) if item != 'x']
def integer_solutions(bus_1, bus_2):
offset = bus_1[0]
increment = bus_1[1]
delay = bus_2[0]
mod_value = bus_2[1]
while((offset + delay) % mod_value != 0):
offset += increment
return(offset, increment * mod_value)
reduce(integer_solutions, constraints_mapping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment