Back to problems

Code Craft: Restaurant Delivery Heatmap

Algorithm · DoorDash · Medium

Requirements Input consists of a grid dimension n and a collection of restaurants. A restaurant entry (i, j, r, d) affects every grid position whose Chebyshev distance from (i, j) is at most r; equivalently, it affects the centered $$(2r+1)\times(2r+1)$$ square, restricted to positions that remain inside the grid. Return an $$n\times n$$ two-dimensional integer array. At location (x, y), store the total of d from every restaurant whose Chebyshev coverage region contains that…

Checking your access…