In this post, we are going to discuss leetcode 1292 — Maximum Side Length of a Square with Sum Less than or Equal to Threshold, which is asked in Google, and Amazon interviews.
Problem Analysis
Given a
m x n
matrixmat
and an integerthreshold
, return the maximum side-length of a square with a sum less than or equal tothreshold
or return0
if there is no such square.
Example 1:
Input: mat = [[1,1,3,2,4,3,2],[1,1,3,2,4,3,2],[1,1,3,2,4,3,2]]…