SECOND GOLFING (my own discovery):
APL (Dyalog Unicode), 63 bytes
f←{⍵↑⊃,/1,¨⌽¨1,¨2⍴⍨¨1+2×1-⍨⍳1+⌈⍟⍵}
Explanation of golfing: The expression that was formerly subscripted does not need to be parenthesized if using ⍵↑
instead of [⍳⍵]
. Savings, 2bytes.