Quitando las capas exteriores

Dada una lista de listas, devuelve un nuevo arreglo de arreglos que contenga todos los elementos, excepto los elementos exteriores.

Ejemplos

peel_layer_off([
  ["a", "b", "c", "d"],
  ["e", "f", "g", "h"],
  ["i", "j", "k", "l"],
  ["m", "n", "o", "p"]
]) ➞ [
  ["f", "g"],
  ["j", "k"]
]

peel_layer_off([
  [1, 2, 3, 4, 5],
  [6, 7, 8, 9, 10],
  [11, 12, 13, 14, 15],
  [16, 17, 18, 19, 20],
  [21, 22, 23, 24, 25],
  [26, 27, 28, 29, 30],
  [31, 32, 33, 34, 35]
]) ➞ [
  [7, 8, 9],
  [12, 13, 14],
  [17, 18, 19],
  [22, 23, 24],
  [27, 28, 29]
]

peel_layer_off([
  [true, false, true],
  [false, false, true],
  [true, true, true]
]) ➞ [[false]]

peel_layer_off([
  ["hello", "world"],
  ["hello", "world"]
]) ➞ []

Notas

  • La cuadrícula 2D siempre tiene una forma rectangular/cuadrada.
  • Devuelve siempre algún tipo de arreglo anidado, a menos que no haya elementos. En ese caso, devuelve un arreglo vacío.