← Citadel Interview Insights

Citadel·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Citadel software engineer round with a grid-based coding problem. Pretty focused session, one meaty algorithmic question and not much else to report.

Questions Asked (1)

Q1

Given a binary grid of 0s and 1s, count the number of distinct islands, where two islands are considered the same if one can be translated (but not rotated or reflected) to match the other.

Algorithms & Data Structures
Author's notes

The translation-only constraint is what makes this interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use DFS/BFS to identify each island, then compute a canonical representation of its shape by normalizing the coordinates relative to the top-left cell. Store these representations in a set to count distinct shapes.

Pro tip: Emphasize that translation invariance is achieved by subtracting the minimum row and column from each cell's coordinates, and mention that using a set of tuples or strings ensures efficient duplicate detection.

1. Traverse the Grid

Iterate through each cell in the grid. When encountering an unvisited '1', start a DFS/BFS to explore the entire island.

2. Collect Island Coordinates

During traversal, record the relative coordinates of each cell in the island with respect to the starting cell (or any reference point).

3. Normalize the Shape

Translate the island so that its top-leftmost cell (minimum row and column) becomes the origin (0,0). This makes the representation invariant to translation.

4. Store Canonical Form

Convert the normalized set of coordinates into a hashable form (e.g., a sorted tuple of coordinates or a string) and add it to a set.

5. Count Distinct Shapes

After processing all islands, the size of the set gives the number of distinct island shapes.

Key Points to Mention

  • DFS/BFS for island traversal
  • Translation invariance via coordinate normalization
  • Using a set to store canonical shapes
  • Time complexity O(R*C) and space complexity O(R*C) for visited tracking and shape storage
  • Handling of edge cases (empty grid, no islands, all water)
  • Avoiding rotation/reflection by not applying any transformations beyond translation

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