Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second (optimal) solution in Speedy category for Min and Max by vikulin
def minmax(op):
def f(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
args = iter(args if len(args) > 1 else args[0])
v = next(args)
k = key(v)
for a in args:
if op(key(a), k):
v, k = a, key(a)
return v
return f
min, max = map(minmax, [lambda a, b: a < b, lambda a, b: a > b])
Sept. 29, 2014