K (oK), 25(削除) 25 (削除ここまで) 24 bytes
Solution:
,/'(1+a,1_|a:!#x)$\:+,:'xx:
Explanation:
Port of my K4 solution:
,/'(1+a,1_|a:!#x)$\:+,:'xx: / the solution
x: / save input as x
,:' / enlist (,:) each (') + / 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
K (oK), 25 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 (,:) each (')
$\: / 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 (')
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
K (oK), 25 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 (,:) each (')
$\: / 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 (')