Skip to main content
added 25 characters in body
Source Link
Mukundan314
  • 13.7k
  • 1
  • 19
  • 62

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Explanation

s.e+@bk&-hyklb@_bk .e # Iterate through implicit input with (b = row, k = index) @bk # b[k] +  &-hyklb@_bkhyklb # plus b[::-1][k]  # if ((2 * k) + 1) - len(b) != 0 + @_bk # plus b[::-1][k] s # sum results from the iteration 

The ((2 * k) + 1) - len(b) is derived from rearranging k - (len(b) - (k + 1))

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Explanation

s.e+@bk&-hyklb@_bk .e # Iterate through implicit input with (b = row, k = index) @bk # b[k] + &-hyklb@_bk # plus b[::-1][k] if ((2 * k) + 1) - len(b) != 0 s # sum results from the iteration 

The ((2 * k) + 1) - len(b) is derived from rearranging k - (len(b) - (k + 1))

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Explanation

s.e+@bk&-hyklb@_bk .e # Iterate through implicit input with (b = row, k = index) @bk # b[k]   &-hyklb   # if ((2 * k) + 1) - len(b) != 0 + @_bk # plus b[::-1][k] s # sum results from the iteration 

The ((2 * k) + 1) - len(b) is derived from rearranging k - (len(b) - (k + 1))

added 367 characters in body
Source Link
Mukundan314
  • 13.7k
  • 1
  • 19
  • 62

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Explanation

s.e+@bk&-hyklb@_bk .e # Iterate through implicit input with (b = row, k = index) @bk # b[k] + &-hyklb@_bk # plus b[::-1][k] if ((2 * k) + 1) - len(b) != 0 s # sum results from the iteration 

The ((2 * k) + 1) - len(b) is derived from rearranging k - (len(b) - (k + 1))

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!

Explanation

s.e+@bk&-hyklb@_bk .e # Iterate through implicit input with (b = row, k = index) @bk # b[k] + &-hyklb@_bk # plus b[::-1][k] if ((2 * k) + 1) - len(b) != 0 s # sum results from the iteration 

The ((2 * k) + 1) - len(b) is derived from rearranging k - (len(b) - (k + 1))

Source Link
Mukundan314
  • 13.7k
  • 1
  • 19
  • 62

Pyth, 18 bytes

s.e+@bk&-hyklb@_bk 

Try it online!