FastPrepMinimum Grid Inconvenience
Problems/Minimum Grid Inconvenience

Minimum Grid Inconvenience

Amazon logoAmazon● HardFULLTIMENEW GRADOA

Updated Nov 2026

QuestionExamples

Problem statement

Special thanks: 🌷 A special thank you to our lovely, amazing frenz who shared that this question appeared again on September 18, 2026, September 19, 2026, September 21, 2026, October 10, 2026, October 27, 2026, November 11, 2026, and November 21, 2026! (˶ᵔ ᵕ ᵔ˶) 💜

A city is represented by a binary grid. A cell marked 1 is a delivery center, and a cell marked 0 is any other place.

The distance between two cells is the maximum of the absolute row-coordinate difference and the absolute column-coordinate difference. The inconvenience of the grid is the maximum, over every 0 cell, of its distance to the nearest delivery center.

The problem statement continues
Pro

Examples

Example 1

grid = [[0,0,0,0],[0,0,0,0],[0,0,0,0]]return = 2
grid
0123000001000020000

With no existing delivery center, it is optimal to convert the center cell (1,1) to 1. The farthest cells then have distance 2.

02 · Example 2
2 original screenshots from the interview report
Pro
FastPrep Pro
Reported in 2 Amazon interviews this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week

More Amazon Online Assessment questions

  • Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
  • Fill One Exact-Length Binary WindowOA · Seen Nov 2026
  • Lexicographically Largest IdentifierOA · Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · Seen Nov 2026
  • Get Smallest Base SegmentOA · Seen Nov 2026
  • Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
  • Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Avoiding the Obstacles (IMC Sydney 🦪)IMC Trading · OAIMC Trading interview questions
  • Find Maximum DistanceWells Fargo · OAWells Fargo interview questions
  • Grid Path With the Most ClearanceDocuSign · OADocuSign interview questions
  • Swim in Rising WaterUiPath · PHONE SCREEN
  • Safest Shortest Path Through a GridSnowflake · OASnowflake interview questions
  • Competitive ForagingAkuna Capital · OAAkuna Capital interview questions
  • Largest Two Non-Overlapping Buildable SquaresAmerican Express · OAAmerican Express interview questions
  • Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
  • Escape the Haunted Castle with TreasuresPersona · OAPersona interview questions
  • Largest Universally Bounded SubgridRoblox · OARoblox interview questions

Interview reports that mention this question

  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
  • Amazon OA: What It Tests (2026) (Part 1 of 5)
  • Amazon OA · November 2026
  • Amazon Experienced Hire OA and Interviews: 21 Experiences
  • Amazon SDE II Onsite and L5 Screens: 7 Experiences (Part 2 of 2)
  • Amazon SDE II OA and Interviews: 10 Experiences (Part 1 of 2)
See Amazon hiring insights
CodePython 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import heapq
from collections import defaultdict
 
class Solution:
def solve(self, values, queries):
# Build the adjacency structure
n = len(values)
graph = defaultdict(list)
for u, v in queries:
graph[u].append(v)
 
best = [float("inf")] * n
heap = [(0, 0)]
while heap:
cost, node = heapq.heappop(heap)
if cost > best[node]:
continue
Run and Submit unlock with Pro
FastPrep Pro
Reported in 2 Amazon interviews this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week