Search
⌘K

Leetcode 3548. Equal Sum Grid Partition II

Determine whether a single straight horizontal or vertical cut can split an m×n grid into two non-empty parts whose sums are equal, or can be made equal by discounting at most one cell from either part—with the extra requirement that the part from which a cell is removed must remain connected. The core challenge is to efficiently check, for every possible cut, if the sum difference is zero or can be matched by removing a single cell whose removal does not disconnect its side (up to 1e5 total cells).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.