Design matrix-operations HTTP service and test strategy

Read the full interview experience this question came from →

Quick Overview

This question evaluates system and API design, input validation, error handling, project architecture, and test strategy for backend services, assessing practical software engineering competencies such as modularity, clarity, and testability.

Design matrix-operations HTTP service and test strategy

Company: League

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

You are given a take-home assignment to build a small backend server. The goal is not algorithmic difficulty but demonstrating solid software engineering practices, project structure, and test design. Design an HTTP service that exposes several APIs to perform operations on 2D matrices of integers. At minimum, support: - Matrix addition - Matrix subtraction - Matrix transpose - Horizontal flip (reverse columns) - Vertical flip (reverse rows) Assume: - Clients send requests over HTTP using JSON. - A matrix is represented as a 2D JSON array of integers, e.g. `[[1, 2], [3, 4]]`. - For binary operations (like addition), the client sends two matrices in the request. - The service should validate input (e.g., shape compatibility for addition) and return clear error responses for invalid input. - Performance is not the primary concern; correctness, clarity, and testability are. Describe in detail: 1. **Overall architecture and project structure** for this server (layers, modules, packages, etc.). 2. **API design**: the endpoints you would expose, HTTP methods, and example request/response payloads for each operation. 3. **Validation and error handling**: how you handle malformed JSON, non-rectangular matrices, dimension mismatches, and unexpected server errors. 4. **Testing strategy**: what unit tests, integration tests, and possibly end-to-end tests you would write, and how you would organize them. 5. Any **additional engineering considerations** you think are important (e.g., logging, configuration, extensibility for adding new matrix operations later).

Overview: This question evaluates system and API design, input validation, error handling, project architecture, and test strategy for backend services, assessing practical software engineering competencies such as modularity, clarity, and testability.

Read the full League Software Engineer interview experience this question came from

|Home/Software Engineering Fundamentals/League
League logo
League
Oct 17, 2025
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
5
0

You are given a take-home assignment to build a small backend server. The goal is not algorithmic difficulty but demonstrating solid software engineering practices, project structure, and test design.

Design an HTTP service that exposes several APIs to perform operations on 2D matrices of integers. At minimum, support:

  • Matrix addition
  • Matrix subtraction
  • Matrix transpose
  • Horizontal flip (reverse columns)
  • Vertical flip (reverse rows)

Assume:

  • Clients send requests over HTTP using JSON.
  • A matrix is represented as a 2D JSON array of integers, e.g. [[1, 2], [3, 4]] .
  • For binary operations (like addition), the client sends two matrices in the request.
  • The service should validate input (e.g., shape compatibility for addition) and return clear error responses for invalid input.
  • Performance is not the primary concern; correctness, clarity, and testability are.

Describe in detail:

  1. Overall architecture and project structure for this server (layers, modules, packages, etc.).
  2. API design : the endpoints you would expose, HTTP methods, and example request/response payloads for each operation.
  3. Validation and error handling : how you handle malformed JSON, non-rectangular matrices, dimension mismatches, and unexpected server errors.
  4. Testing strategy : what unit tests, integration tests, and possibly end-to-end tests you would write, and how you would organize them.
  5. Any additional engineering considerations you think are important (e.g., logging, configuration, extensibility for adding new matrix operations later).
Loading comments...