CMC:
code-golf Given an edge-connected region of 1s as a rectangular binary matrix consisting of
n
numbers, output number of holes in it. Assume the matrix is surrounded by zeroes, and a hole is a edge-connected region of 0s inside the 1 block. Use O(log n) memory and O(n log n) time, in bit complexity (O(1) mem and O(n) time in word complexity, assume a word is O(log n) bits).