← Oracle Interview Insights

Oracle·Data Scientist·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Interviewed for a Data Scientist role at Oracle and got a grid-based coding problem that felt more like a software engineering interview than anything data-related. Not what I was expecting going in.

Questions Asked (1)

Q1

Given a binary grid where 1 represents land and 0 represents water, write a function that counts the number of 'closed islands', meaning connected land regions that do not touch any edge of the grid.

Algorithms & Data Structures
Author's notes

Took me a minute to even parse what 'closed' meant here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a graph traversal algorithm (DFS or BFS) to identify all land cells connected to the grid's edges and mark them as non-closed. Then, iterate through the grid to count the remaining unvisited land components, which are the closed islands.

Pro tip: Clarify edge cases upfront, such as empty grid or all water, and discuss time/space complexity. Mention that you can optimize by modifying the grid in-place to avoid extra space.

1. Understand the problem and edge cases

Confirm that closed islands are land regions not touching any edge. Discuss edge cases: empty grid, all water, all land, single row/column.

2. Choose traversal method

Decide between DFS (recursive or iterative) and BFS. Consider recursion depth for large grids; iterative DFS or BFS may be safer.

3. Mark edge-connected land

Traverse all land cells on the four edges and perform DFS/BFS to mark all connected land as visited (e.g., change 1 to 0 or use a visited set).

4. Count closed islands

Iterate through the grid; for each unvisited land cell, increment count and traverse to mark the entire island as visited.

5. Analyze complexity and optimize

State time complexity O(m*n) and space complexity O(m*n) for visited set or O(1) if modifying grid in-place. Discuss trade-offs.

Key Points to Mention

  • Graph traversal algorithms: DFS and BFS
  • Connected components in a grid
  • Edge detection and boundary conditions
  • In-place modification to save space
  • Time and space complexity analysis
  • Handling large grids and recursion limits

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.