Programming Interview Question — Maximum Connected Area

Lintcode question #261 or Leetcode #695

Question Setup

There is a two-dimensional array, only consists of 00 and 11.

You can change a 0 to 1 at most once, please calculate the maximum area of connected 1s.

If two 1s are adjacent up to down or left to right, they are regarded connected.