for each plant cell if the adjacent cell sharing a side is not a plant then we must put a fence in b/w them .
Yes based on that,
we assume all cells are individual at first and would need 4 boundries for each.
next, now we no we don’t need boundaries where two plant cells meet (common/sharing edges), and that would decrease our boundary size by 2 (one less boundary for each cell among them).
here total number of cells is 6 and number of sharing edges is 7
ans is (4 * 6) - (7 * 2) = 10 (which is the expected answer).
i don’t see why this fails?
I cannot come up with a smaller tc but you can try this one .
your output is comming 32 but from accepted code it is comming 30.
7 7 8
it was a very minor mistake.
i want to die real quick, how didn’t i see the whole return statement was missing in comparators.