Created
December 13, 2020 16:12
-
-
Save ryan-kasi/84243102d2ece47119691f256bc906c3 to your computer and use it in GitHub Desktop.
This file contains 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
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