LC: 1183. Maximum Number of Ones
https://leetcode.com/problems/maximum-number-of-ones/
Input: width = 3, height = 3, sideLength = 2, maxOnes = 1
Output: 4
Explanation:
In a 3*3 matrix, no 2*2 sub-matrix can have more than 1 one.
The best solution that has 4 ones is:
[1,0,1]
[0,0,0]
[1,0,1]Input: width = 3, height = 3, sideLength = 2, maxOnes = 2
Output: 6
Explanation:
[1,0,1]
[1,0,1]
[1,0,1]PreviousLC: 1180. Count Substrings with Only One Distinct LetterNextLC: 1196. How Many Apples Can You Put into the Basket
Last updated