← CrowdStrike Interview Insights

CrowdStrike·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Crowdstrike coding round, pretty much a grid traversal problem. Nothing too wild but you'd better know your BFS/DFS cold going in.

Questions Asked (1)

Q1

Given a 2D binary grid where 1s are land and 0s are water, count the total number of islands (connected groups of 1s, connected horizontally or vertically).

Algorithms & Data Structures
Author's notes

Classic LC 200 in disguise.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Treat the grid as a graph and use DFS/BFS to explore each unvisited land cell, marking all connected land as visited. Each time you start a traversal from an unvisited land cell, increment the island count. Alternatively, use Union-Find to merge adjacent land cells and count unique components.

Pro tip: Discuss trade-offs between DFS (recursive, may risk stack overflow on large grids) and BFS (iterative, uses queue) and mention Union-Find for dynamic connectivity. Also, clarify if you can modify the input grid to save space, and handle edge cases like empty grid.

1. Clarify and Validate

Confirm grid dimensions, connectivity definition (4-directional), and whether input can be modified. Discuss edge cases: empty grid, all water, all land.

2. Choose Algorithm

Select DFS, BFS, or Union-Find based on constraints and preferences. Explain why (e.g., DFS for simplicity, BFS to avoid recursion depth, Union-Find for dynamic scenarios).

3. Implement Traversal

Iterate through each cell; when encountering unvisited land, increment count and launch traversal to mark all connected land as visited (e.g., set to '0' or use visited set).

4. Analyze Complexity

State time complexity O(M*N) and space complexity O(M*N) for visited set or O(min(M,N)) for BFS queue in worst case. Mention that modifying input reduces space to O(1) extra.

5. Test and Optimize

Walk through a small example, test edge cases, and discuss potential optimizations (e.g., early termination, iterative DFS).

Key Points to Mention

  • Graph traversal: DFS/BFS to explore connected components.
  • Visited tracking: modify grid in-place or use separate visited matrix.
  • Time complexity: O(M*N) where M and N are grid dimensions.
  • Space complexity: O(M*N) worst-case for recursion/queue, O(1) if grid modified.
  • Union-Find alternative: union adjacent land cells, count unique roots.
  • Edge cases: empty grid, single row/column, all land/water.

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