NeetCode #898LC-1183HardMath & GeometryNC Algo100
← Back to All Problems#898 · #1183 · Maximum Number of Ones(矩阵中 1 的最大数量)
📌 Problem Statement & Constraints
You are given the dimensions
width and height of a binary matrix, a window size sideLength, and maxOnes. Place ones so that every sideLength x sideLength submatrix contains at most maxOnes ones, and return the maximum possible total number of ones. Constraints: 1 <= width, height <= 10^9, 1 <= sideLength <= min(width, height), 0 <= maxOnes <= sideLength^2.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!