Largest Plus Sign
Updated
Problem statement
You have an n x n binary grid initially filled with ones. Every coordinate in mines is changed to zero.
An axis-aligned plus sign of order k has a center cell and four arms of ones extending k - 1 cells up, down, left, and right. Return the largest possible order. Return 0 if the grid contains no one.
Function
orderOfLargestPlusSign(n: int, mines: int[][]) → intExamples
Example 1
n = 5mines = [[4,2]]return = 2A plus centered at [2,2] has one cell in each arm, so its order is 2.
Example 2
n = 1mines = [[0,0]]return = 0The only cell is zero.
Constraints
1 <= n <= 500.0 <= mines.length <= n * n.- Every mine is a distinct pair
[row, col]with0 <= row, col < n.
More xAI interview questions
- Longest Common SubstringOA · Seen May 2025
- Sort Concentric Matrix RingsOA · Seen May 2025
- Resumable List IteratorPHONE SCREEN · Seen Apr 2026
- Earliest Dataset Readiness in a PipelinePHONE SCREEN · Seen Mar 2026
- Live Top-K Spaces by Active UsersONSITE INTERVIEW · Seen Jan 2026
- Total Active Time by SpaceONSITE INTERVIEW · Seen Jan 2026
- Dynamic Batch Decode TraceONSITE INTERVIEW · Seen Dec 2025
- Nested Transaction Key-Value StoreONSITE INTERVIEW · Seen Oct 2025
- Weighted LRU CacheONSITE INTERVIEW · Seen Oct 2025
- LFU CacheONSITE INTERVIEW · Seen Sep 2025
Similar questions at other companies
- Largest Square of OnesOpenAI · OAOpenAI interview questions
- Cherry PickupInfosys · OAInfosys interview questions
- Maximum Sum RectangleDeloitte · OADeloitte interview questions
- Assign Escalations to TeamsAmazon · ONSITE INTERVIEW
- Find Robots by Blocker DistancesUber · PHONE SCREENUber interview questions
- Factory Cost — Minimum Cost Across StagesStripe · PHONE SCREENStripe interview questions
- Maximum All-Ones Square Side LengthOmnissa · ONSITE INTERVIEWOmnissa interview questions
- Maximum Rocks on a North-or-East Grid PathGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
- Maximal SquareAirwallex · PHONE SCREENAirwallex interview questions
- Maximal SquareSalesforce · PHONE SCREENSalesforce interview questions