generate functionTue, 08 Nov 2022

You are given a matrix A representing a chessboard with N rows and M columns. Each square of the chessboard contains an integer representing a points-based score. You have to place two rooks on the chessboard in such a way that they cannot attack each other and the sum of points on their squares is maximal. Rooks in chess can attack each other only if they are in the same row or column. For example, given a matrix as in the following picture:

int maxPoints(int** A, int N, int M) { return 0; }

Questions about programming?Chat with your personal AI assistant