Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created January 15, 2016 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/3f4ecb239030f447dcef to your computer and use it in GitHub Desktop.
Save whatalnk/3f4ecb239030f447dcef to your computer and use it in GitHub Desktop.
TopCoder SRM #678 Div2
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