Consider a binary matrix with dimensions width and height. You are also given an integer sideLength representing the side length of a square subgrid, and an integer maxOnes.
Return the maximum number of ones that can be placed in the matrix such that every square subgrid of size sideLength by sideLength contains at most maxOnes ones.
Constraints:
width, height
sideLength width, height
maxOnes sideLength $ imes$ sideLength
Consider a binary matrix with dimensions width and height. You are also given an integer sideLength representing the side length of a square subgrid, and an integer maxOnes.
Return the maximum number of ones that can be placed in the matrix such that every square subgrid of size sideLength by sideLength contains at most maxOnes ones.
Constraints:
width, height
sideLength width, height
maxOnes sideLength $ imes$ sideLength