PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Asana

Implement core puzzle/array/grid routines

Last updated: May 1, 2026

Quick Overview

This question set evaluates algorithmic problem-solving competencies including backtracking and constraint satisfaction for jigsaw assembly, simulation and state manipulation for ASCII canvas and 2048 move logic, and linear-time in-place array transformation for the product-of-array problem.

  • medium
  • Asana
  • Coding & Algorithms
  • Software Engineer

Implement core puzzle/array/grid routines

Company: Asana

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You may be asked to solve one or more of the following coding exercises (write clean, testable code; discuss time/space complexity): 1) **Jigsaw assembly (small backtracking)** - You are given `N` square tiles. Each tile has 4 edge labels: `top`, `right`, `bottom`, `left` (strings). Two adjacent tiles are compatible if the touching edges have the same label. - A tile may be rotated (0/90/180/270 degrees), which permutes its edge labels. - Given integers `R` and `C` such that `R*C == N`, determine whether the tiles can be arranged into an `R x C` grid so that **all internal adjacent edges match**. (Optionally: also return one valid arrangement of tile IDs and rotations.) - Assume `N` is small enough for backtracking (e.g., `N <= 12`). 2) **ASCII canvas printer** - Implement an ASCII drawing engine with a blank canvas of size `H x W` initialized with spaces. - You will receive a list of drawing commands such as: - `RECT x y width height ch` (fill the rectangle with character `ch`) - `HLINE x1 x2 y ch` (draw a horizontal line) - `VLINE x y1 y2 ch` (draw a vertical line) - Later commands overwrite earlier ones. - Output the final canvas as `H` lines of `W` characters. 3) **Product of array except self** - Given an integer array `nums` of length `n`, return an array `out` where `out[i]` equals the product of all `nums[j]` for `j != i`. - Do not use division. - Target `O(n)` time; extra space should be `O(1)` besides the output array. 4) **2048 move simulation** - Given a `4 x 4` grid of non-negative integers (powers of two or zero) and a direction in `{left, right, up, down}`: - Slide all tiles as far as possible in that direction. - Merge equal adjacent tiles once per move (e.g., `2 2 2 0` moving left becomes `4 2 0 0`, not `8 0 0 0`). - Return the updated grid (optionally also return the score gained from merges).

Quick Answer: This question set evaluates algorithmic problem-solving competencies including backtracking and constraint satisfaction for jigsaw assembly, simulation and state manipulation for ASCII canvas and 2048 move logic, and linear-time in-place array transformation for the product-of-array problem.

Related Interview Questions

  • Solve a Jigsaw Puzzle - Asana (medium)
  • Compute Products Excluding Each Index - Asana (medium)
  • Implement an ASCII Art Printer - Asana (medium)
  • Implement ASCII canvas and solve two data problems - Asana (medium)
Asana logo
Asana
Jan 7, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
18
0

You may be asked to solve one or more of the following coding exercises (write clean, testable code; discuss time/space complexity):

  1. Jigsaw assembly (small backtracking)
  • You are given N square tiles. Each tile has 4 edge labels: top , right , bottom , left (strings). Two adjacent tiles are compatible if the touching edges have the same label.
  • A tile may be rotated (0/90/180/270 degrees), which permutes its edge labels.
  • Given integers R and C such that R*C == N , determine whether the tiles can be arranged into an R x C grid so that all internal adjacent edges match . (Optionally: also return one valid arrangement of tile IDs and rotations.)
  • Assume N is small enough for backtracking (e.g., N <= 12 ).
  1. ASCII canvas printer
  • Implement an ASCII drawing engine with a blank canvas of size H x W initialized with spaces.
  • You will receive a list of drawing commands such as:
    • RECT x y width height ch (fill the rectangle with character ch )
    • HLINE x1 x2 y ch (draw a horizontal line)
    • VLINE x y1 y2 ch (draw a vertical line)
  • Later commands overwrite earlier ones.
  • Output the final canvas as H lines of W characters.
  1. Product of array except self
  • Given an integer array nums of length n , return an array out where out[i] equals the product of all nums[j] for j != i .
  • Do not use division.
  • Target O(n) time; extra space should be O(1) besides the output array.
  1. 2048 move simulation
  • Given a 4 x 4 grid of non-negative integers (powers of two or zero) and a direction in {left, right, up, down} :
    • Slide all tiles as far as possible in that direction.
    • Merge equal adjacent tiles once per move (e.g., 2 2 2 0 moving left becomes 4 2 0 0 , not 8 0 0 0 ).
  • Return the updated grid (optionally also return the score gained from merges).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Asana•More Software Engineer•Asana Software Engineer•Asana Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.