Score After Flipping Matrix
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You have an m x n binary matrix grid. A *move* picks one entire row or one entire column and toggles every bit in it (0 becomes 1, 1 becomes 0). You may make any number of moves.
Each row is then read as a binary number with the leftmost cell as the most significant bit. The *score* of the matrix is the sum of these numbers.
Return the maximum score you can reach.
Examples
Constraints
- `1 <= m, n <= 20`
- `grid[i][j]` is `0` or `1`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.