2dbi
Home/Nvidia/Number of Islands
NNvidia·DSASDE-2Technical Phone Screen

Number of Islands

Problem

Count islands in an m × n binary grid (4-directional connectivity).

Example

[[1,1,0],[0,1,0],[0,0,1]] -> 2

Constraints

  • 1 ≤ m,n ≤ 300

Follow-up

How would you parallelize the count across GPU threads / tiles?

added 6 days ago
LeadersAccount