#3256
Maximum Value Sum by Placing Three Rooks I
hard · 16.4% accepted · 109 likes · top 1%
array · dynamic programming · matrix · enumeration
Description
You are given a m x n 2D array board representing a chessboard, where board[i][j] represents the value of the cell (i, j).
Rooks in the same row or column attack each other. You need to place three rooks on the chessboard such that the rooks do not attack each other.
Return the maximum sum of the cell values on which the rooks are placed.
Solution