Maximum Side Length of a Square with Sum Less than or Equal to Threshold | 2 Ways | Leetcode 1292
Автор: codestorywithMIK
Загружено: 2026-01-18
Просмотров: 9376
iPad PDF Notes Link - https://github.com/MAZHARMIK/Intervie...
Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
Hi Everyone, this is the 171st video of our Playlist "Arrays 1D-2D : Popular Interview Problems" by codestorywithMIK.
Today we will be solving a good problem based out of 2D Array and Prefix Sum : Maximum Side Length of a Square with Sum Less than or Equal to Threshold | 2 Approaches | Leetcode 1292 | codestorywithMIK
Problem Name : Maximum Side Length of a Square with Sum Less than or Equal to Threshold | 2 Approaches | Leetcode 1292 | codestorywithMIK
Company Tags : will update later
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://leetcode.com/problems/maximum...
My DP Concepts Playlist : • Roadmap for DP | How to Start DP ? | Topic...
My Graph Concepts Playlist : • Graph Concepts & Qns - 1 : Graph will no m...
My Segment Tree Concepts Playlist : • Segment Tree | Introduction | Basics | Bui...
My Recursion Concepts Playlist : • Introduction | Recursion Concepts And Ques...
Trie Playlist - • Word Search II | Leetcode 212 | Detailed |...
Difference Array Technique: Concepts & Qns : • Introduction | What | How | Difference Arr...
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Intervie...
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Subscribe to my channel : / @codestorywithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Video Summary :
First, build a 2D prefix sum so the sum of any square can be computed in constant time.
Approach 1 : fixes each cell as the top-left corner and keeps expanding the square greedily until the sum crosses the threshold.
Approach 2 : observes that if a square of side k works, smaller squares will also work, so it binary searches on the side length.
Prefix sums are the key that make both approaches efficient by avoiding repeated sum calculations.
✨ Timelines✨
00:00 Introduction
00:25 Motivation
01:05 Problem Explanation
03:21 Constraints Analysis
03:50 Thought Process - Approach - 1
24:08 How to find Prefix sum in 2D Grid ?
36:10 Using Prefix Grid to find Square sum in O(1)
45:01 Coding it up - Approach-1
52:46 Thought Process - Approach - 2
57:58 Coding it up - Approach-2
#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: