Explain code complexity and design two games
Company: Asana
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
You are given three independent interview prompts.
1) **Code comprehension & complexity**
- Given two short code snippets (language-agnostic), explain in plain English what each snippet does.
- Analyze **time complexity** and **space complexity** (Big-O). State any assumptions (e.g., input size, data structure costs).
2) **Object-oriented design: Jigsaw puzzle**
Design the core classes and APIs for a jigsaw puzzle application.
- Pieces can be rotated.
- Each piece has 4 sides that must match adjacent pieces.
- The board supports placing, removing, and validating placements.
- Describe key classes, relationships, and important methods. You may include high-level pseudocode.
3) **Object-oriented design: 2048 game**
Design the core logic and data model for the 2048 game.
- 4x4 grid of tiles with values (2,4,8,...).
- A move (up/down/left/right) slides tiles and merges equal adjacent tiles once per move.
- After a valid move, spawn a new tile (usually 2 or sometimes 4) in an empty cell.
- Track score and detect game-over.
- Provide classes/data structures and the algorithm to process a move.
Overview: This multi-part question evaluates code comprehension and algorithmic complexity analysis alongside object-oriented design competencies for interactive applications, covering skills in analyzing time and space complexity, class modeling, API design, and state management.
Read the full Asana Software Engineer interview experience this question came from