Count Interior Islands After Flooding
Company: Oracle
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates understanding of grid-based graph traversal and connected-component detection, focusing on flood-fill logic and the treatment of boundary-connected regions in a binary grid.
Read the full Oracle Data Scientist interview experience this question came from
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([[0,0,0,0],[0,1,1,0],[0,1,0,0],[0,0,0,0]],)
Expected Output: 1
Explanation: One closed island.
Input: ([[1,1],[1,0]],)
Expected Output: 0
Explanation: Boundary land not counted.
Hints
- Model object-style prompts as operation streams when needed.
- Handle empty and boundary cases before the main logic.