Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

1 of 7
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6), 138 bytes

Expects (p)(q).

p=>q=>(X=2*(g=(q,h=o=[1],v=n=x=y=0)=>n-q|x-q[0]|y-q[1]?g(q,...o[o[[x-=h,y-=v]]=++n,[x-v,y+h]]?[h,v]:[v,-h]):x)(q),Y=2*y,g([X-g(p),Y-y]),n)

Try it online!

Arnauld
  • 205.5k
  • 21
  • 187
  • 670

AltStyle によって変換されたページ (->オリジナル) /