fork download
  1. f=lambda x:-min(x.pop(0)-max(x),x[1:]and-f(x))
  2.  
  3. for x in [1,2,3,4,5], [1,99,2,105], [99,1,99,100], [99,1,1,2,1,3], [5,4,3,3,1], [5,4,3,1], [5,2,1], [5,4,1], [55,45,20,1], [5,1], [10,7,5,1]:
  4. print f(x)
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
4
104
99
2
0
-1
-1
-1
-10
-4
-2