Explain code complexity and design two games
AsanaSoftware Engineer · Technical ScreenLast updated
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.
You are given three independent interview prompts.
- 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).
- 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.
- 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.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.