Boxes and Walls in a 2D Array
You are given a two dimensional array containing arrays of strings as an argument. Each string element will be either a _
, .
, or |
. These symbols are used to form boxes in the array. Return true if each _
and |
is the side of a box, false if not.
Requirements
- Must return either true or false
Example #1
solve([
['.', '_', '_', '.', '.'],
['.', '|', '|', '.', '.'],
['.', '_', '_', '.', '.']
])
> true
Return true since each _
and |
forms the sides of a box.
Example #2
solve([
['.', '_', '_', '.', '.'],
['.', '.', '|', '.', '.'],
['.', '_', '_', '.', '.']
])
> false
Return false because the box is missing its left |
wall