Skip to main content
2 of 7
edited body
digEmAll
  • 5k
  • 14
  • 22

R, 43 bytes

function(v)rank(c(11,0,10,1:4*0,2:4)[v])[1]

Try it online!


If the input vector is not acceptable, then a possible 2-parameters alternative is :

R, 51 bytes

function(a,b,x=c(11,0,10,1:4*0,2:4))sign(x[a]-x[b])

Try it online!

digEmAll
  • 5k
  • 14
  • 22