Created
January 15, 2016 03:44
-
-
Save whatalnk/3f4ecb239030f447dcef to your computer and use it in GitHub Desktop.
TopCoder SRM #678 Div2
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
class ThePhantomMenace: | |
def find(self, doors, droids): | |
if type(doors) == int: | |
doors = [doors] | |
else: | |
doors = list(doors) | |
if type(droids) == int: | |
droids = [droids] | |
else: | |
droids = list(droids) | |
res = 0 | |
for d in doors: | |
safety = min([abs(d - i) for i in droids]) | |
res = max([res, safety]) | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment