Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

A leading food delivery platform is analyzing its service coverage in a city grid. The city is represented by two binary m × n matrices of the same dimensions: availability and users.

  • availability[i][j] = 1 indicates a delivery driver (a "dasher") is available at coordinate (i, j).
  • users[i][j] = 1 indicates a customer is located at coordinate (i, j).

A user cluster is a group of one or more customers located in 1 cell that are connected 4-directionally (up, down, left, or right). Customers in cells that are only connected diagonally are not considered part of the same cluster.

Test Cases
Input
Output
Expected