← Asana Interview Insights

Asana·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Asana coding round with a puzzle assembly problem that sounds deceptively manageable until you're mid-explanation and realize you haven't thought through the edge cases at all.

Questions Asked (1)

Q1

Given a set of 2D jigsaw puzzle pieces where each piece has descriptors for its four edges, assemble them into a complete grid so that adjacent edges match correctly.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I jumped straight to backtracking and the interviewer kind of let me run with it before asking how I'd handle ambiguous matches.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (e.g., piece count, edge matching rules, whether the grid dimensions are known). Then propose a backtracking algorithm that places pieces one by one, using a hash map to quickly find matching edges, and discuss optimizations like constraint propagation and symmetry breaking. Finally, analyze time and space complexity and trade-offs between different approaches.

Pro tip: Mention that you would first check if the puzzle is solvable by verifying edge counts (each internal edge must appear exactly twice) and that you can use a union-find or graph-based approach to detect inconsistencies early. This shows you think about edge cases and validation before diving into the algorithm.

1. Clarify requirements and constraints

Ask about grid size, piece count, edge descriptor format, whether pieces can be rotated, and if the puzzle is guaranteed solvable. This ensures you understand the problem scope.

2. Design a backtracking algorithm

Propose placing pieces row by row (or column by column), checking that left and top edges match already placed pieces. Use recursion and backtrack when no piece fits.

3. Optimize with data structures

Use a hash map to index pieces by their edge descriptors (e.g., map from edge type to list of pieces with that edge) to quickly find candidates for a given position.

4. Apply pruning and heuristics

Implement constraint propagation: after placing a piece, update the set of possible pieces for adjacent empty slots. Use heuristics like most-constrained-variable to reduce branching.

5. Analyze complexity and trade-offs

Discuss worst-case exponential time, but note that with good pruning it can be efficient. Compare with alternative approaches like exact cover (DLX) or graph matching.

Key Points to Mention

  • Backtracking with recursion and pruning
  • Hash map for O(1) edge matching lookups
  • Constraint propagation to reduce search space
  • Handling rotations and edge cases (e.g., border pieces)
  • Time and space complexity analysis
  • Trade-offs between backtracking and exact cover algorithms

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