Find Suitable Locations

Problem Overview

  • Count empty plots where a store can be built so every house is within distance K using grid steps (no diagonals).
  • Input: matrix A (N×M) with 0=empty, 1=house, and integer K; Output: number of suitable locations.
  • Real-world context: a retail chain selecting a new branch site in a neighborhood grid.
  • From Microsoft interviews: a coding interview problem/interview question; implement findSuitableLocations(A, K).

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: