3276. Select Cells in Grid With Maximum Score
You are given a 2D matrix
grid
consisting of positive integers.You have to select one or more cells from the matrix such that the following conditions are satisfied:
- No two selected cells are in the same row of the matrix.
- The values in the set of selected cells are unique.
Your score will be the sum of the values of the selected cells.
Return the maximum score you can achieve.
MCMF
c++
1 | const int MAX_N = 121; |
DP + Bits
c++
1 | class Solution { |