← Asana Interview Insights

Asana·Software Engineer·Onsite - System Design / Architecture·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Asana system design round, one question the whole time. The problem was deceptively open-ended and I kept second-guessing myself on where to even start.

Questions Asked (1)

Q1

Design a jigsaw puzzle solver. You're given a match(e1, e2) function that tells you whether two edges fit together. The number of rows and columns is not known in advance. How do you implement the solve function?

Algorithms & Data StructuresSystem Design
Author's notes

The match function being a black box was the part that messed me up early.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying assumptions and constraints, then propose a greedy algorithm that builds the puzzle from a corner using the match function to find compatible edges. Discuss how to handle unknown dimensions by dynamically tracking rows and columns as pieces are placed.

Pro tip: Mention that you would optimize the match function calls by caching results or using a hash of edge signatures, and discuss how to handle ambiguous matches (multiple pieces fitting) by backtracking or using a priority queue.

1. Clarify assumptions and constraints

Ask about the input format (list of pieces, each with four edges), whether pieces can be rotated, and if the match function is symmetric and deterministic. Confirm that the puzzle is rectangular and all pieces are used.

2. Design a greedy placement strategy

Start with an arbitrary piece as the top-left corner. Use match to find pieces that fit to its right and bottom, then continue placing pieces row by row, using already placed pieces to determine the next piece's position.

3. Handle unknown dimensions and boundaries

Maintain a grid data structure that expands as needed. When placing a piece, check if it fits with all adjacent placed pieces. If no piece fits to the right, start a new row; if no piece fits below, the puzzle is complete.

4. Address ambiguous matches and backtracking

If multiple pieces match, use backtracking or a priority queue to explore possibilities. Alternatively, use a constraint satisfaction approach with forward checking to prune invalid placements early.

5. Analyze complexity and optimizations

Discuss time complexity (e.g., O(n^2) match calls in the worst case) and propose optimizations like caching match results, indexing pieces by edge features, or parallelizing match calls.

Key Points to Mention

  • Greedy algorithm with backtracking for ambiguous cases
  • Dynamic grid expansion to handle unknown dimensions
  • Caching or memoization of match function results
  • Edge representation and rotation handling
  • Time and space complexity analysis
  • Potential use of constraint satisfaction or graph matching

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