Skip to main content
added 36 characters in body
Source Link
Razetime
  • 27.6k
  • 3
  • 31
  • 77

APL (Dyalog Unicode), 1212 11 bytes

0∘{⍵∇⍨⎕←⍺⌷⍵⍺∇⎕←⍵⌷⍺}∘0 

Try it online!Try it online!

0-indexed, takes input as the rightleft argument.

-1 byte from user.

0∘{⍵∇⍨⎕←⍺⌷⍵⍺∇⎕←⍵⌷⍺}∘0 0∘ {⍺∇⎕←⍵⌷⍺}∘0 take 0 as initial leftright argument   ⎕←⍺⌷⍵ ⎕←⍺⌷⍵ print element at leftright arg ⍺∇ ⍵⌷⍺ ⍵∇⍨ ⍺⌷⍵ recursive call with the input and new leftright arg 

APL (Dyalog Unicode), 12 bytes

0∘{⍵∇⍨⎕←⍺⌷⍵} 

Try it online!

0-indexed, takes input as the right argument.

0∘{⍵∇⍨⎕←⍺⌷⍵} 0∘  take 0 as initial left argument   ⎕←⍺⌷⍵ print element at left arg ⍵∇⍨ ⍺⌷⍵ recursive call with the input and new left arg 

APL (Dyalog Unicode), 12 11 bytes

{⍺∇⎕←⍵⌷⍺}∘0 

Try it online!

0-indexed, takes input as the left argument.

-1 byte from user.

{⍺∇⎕←⍵⌷⍺}∘0 {⍺∇⎕←⍵⌷⍺}∘0 take 0 as initial right argument ⎕←⍺⌷⍵ print element at right arg ⍺∇ ⍵⌷⍺ recursive call with the input and new right arg 
Source Link
Razetime
  • 27.6k
  • 3
  • 31
  • 77

APL (Dyalog Unicode), 12 bytes

0∘{⍵∇⍨⎕←⍺⌷⍵} 

Try it online!

0-indexed, takes input as the right argument.

0∘{⍵∇⍨⎕←⍺⌷⍵} 0∘ take 0 as initial left argument ⎕←⍺⌷⍵ print element at left arg ⍵∇⍨ ⍺⌷⍵ recursive call with the input and new left arg