Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1895. Largest Magic Square
Find the largest side length k of any k×k subgrid whose every row sum, every column sum, and both diagonal sums are equal (entries need not be distinct). With m,n ≤ 50 the core challenge is efficiently testing all candidate squares—typically by enumerating sizes/positions and using prefix sums to verify row, column and diagonal sums quickly.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.