Skip to main content
2 of 7
added 2 characters in body
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 28 bytes

Inspired by Sanchises' answer to a loosely related challenge. I think the approach is also similar to that in Jonah's answer to this challenge.

1JO2Bli:"6Mh]htn:Eq*^YphYsXG 

The output is rotated 90 degrees with respect to the examples. That is, the first segment is right, not up.

Try it at MATL online!

The code plots more steps than necessary. With input 11 it gives F14 as shown in the challenge (rotated):

enter image description here

Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382