K (oK), (削除) 25 (削除ここまで) 24 bytes
Solution:
,/'(1+a,1_|a:!#x)$\:+,x:
Explanation:
Port of my K4 solution:
,/'(1+a,1_|a:!#x)$\:+,x: / the solution
x: / save input as x
, / enlist
+ / flip
$\: / pad ($) right by each-left (\:)
( ) / do this together
#x / count length of input, e.g. 3
! / range 0..length, e.g. 0 1 2
a: / save as a
| / reverse it, e.g. 2 1 0
1_ / drop first, e.g. 1 0
a, / join to a, e.g. 0 1 2 1 0
1+ / add 1, e.g. 1 2 3 2 1
,/' / flatten (,/) each (')
Notes:
- -1 byte thanks to ngn
mkst
- 5.3k
- 13
- 19