Skip to main content
2 of 2
Commonmark migration

Mathematica, 65

f=-Order@@MapIndexed[If[#>Last@#2,#,a-b#]&,PadRight[{##}+1],{2}]&

Usage:

f[{1, 2, 1, 1, 6}, {1, 2, 1, 1, 7}]

-1

alephalpha
  • 50k
  • 7
  • 68
  • 182