1297. Maximum Number of Ones

You are given a width x height matrix filled with 0s. You may set some cells to 1, subject to the rule that every sideLength x sideLength sub-square contains at most maxOnes ones. Return the maximum total number of 1s the whole matrix can contain.

The function receives its arguments in the order (width, height, sideLength, maxOnes).

Examples
Input: [1,101,1,0]
Output: 0
Hints

1297. Maximum Number of Ones

You are given a `width x height` matrix filled with 0s. You may set some cells to 1, subject to the rule that every `sideLength x sideLength` sub-square contains at most `maxOnes` ones. Return the maximum total number of 1s the whole matrix can contain.