Something in the Box?

Published by Helen Yu in

Create a function that returns True if an asterisk * is inside a box.

Examples

in_box([
  "###",
  "#*#",
  "###"
]) ➞ True


in_box([
  "####",
  "#* #",
  "#  #",
  "####"
]) ➞ True


in_box([
  "*####",
  "# #",
  "#  #*",
  "####"
]) ➞ false


in_box([
  "#####",
  "#   #",
  "#   #",
  "#   #",
  "#####"
]) ➞ False

Notes

The asterisk may be in the array, however, it must be inside the box, if it exists.

Watch a quick demo on how Edabit works.