Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short Dict solution in Clear category for Building Visibility by DanielDou
# migrated from python 2.7
# From Daniel Dou with love...
def checkio(x):
x = sorted(x, key = lambda o: o[1])
dog = {}
for i in range(len(x)):
for j in range((x[i][0])*2, (x[i][2])*2+1):
if dog.get(j, 0) == 0 or x[i][-1] > dog[j][-1][0]:
dog[j] = dog.get(j, []) + [(x[i][-1], i+1)]
return len(set([m for k in list(dog.values()) for m in k]))
March 7, 2014
Comments: