Maximum Sub Square Matrix Sum Less Than K

Easyimc

Problem Overview

  • Find the largest square size s such that every s×s submatrix of an n×n matrix has a sum not exceeding k.
  • Input: n×n integer matrix and integer threshold k. Output: maximum valid side length s.
  • Relevant to sliding-window sum checks in matrices for data analysis or image processing.
  • From Imc interviews; a coding interview problem and a common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: