Leetcode 1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix
Given a small m×n (m,n ≤ 3) binary matrix, find the minimum number of operations that flip a chosen cell and its up/down/left/right neighbors to transform the matrix to all zeros, or return -1 if impossible. This is a shortest-path search over the 2^(m·n) state space (use bitmask/BFS reasoning due to the small grid).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.