12. Isthmus 2D

An isthmus is a narrow piece of land with water on both sides, connecting two larger areas. Panama is an isthmus connecting North and South America.

An isthmus location contains a non-zero number with the same number to the left and right, and has zeros above and below.

In the example below, the middle 5 is an isthmus location.

  0
5 5 5
  0

Given 2d array of ints, count the number of isthmus locations that contain odd numbers.

Test code