← Sigma Computing Interview Insights

Sigma Computing·Frontend Engineer·Onsite - Coding / Algorithms·Intermediate

Intermediate
Apr 2026

Summary

JS coding round at Sigmacomputing for a frontend role. The main problem was a task manager class with some tricky async ordering requirements, and they kept layering on follow-ups until it got pretty involved.

Questions Asked (1)

Q1

Implement a task manager class that runs callbacks in the order they were registered, even if the callbacks themselves have different execution delays. For example, if task 2 is scheduled to finish before task 1 but task 1 was registered first, task 1 should still execute first.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The core of this is basically: don't just let Promises resolve in whatever order they feel like.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the task manager must enforce registration order regardless of callback execution delays, then propose a solution using a queue and a flag to serialize execution. Discuss trade-offs between simplicity and concurrency, and mention potential improvements like error handling and cancellation.

Pro tip: Emphasize that this is essentially a sequential task runner; by acknowledging that callbacks may be asynchronous, you show depth. Also, mention that you'd write tests to verify order under varying delays.

1. Clarify requirements and constraints

Ask if callbacks can be asynchronous, if errors should halt execution, and if tasks can be cancelled. Confirm that order is strictly registration order.

2. Design the data structure

Use a queue (array) to store tasks in registration order. Maintain a flag (e.g., isRunning) to ensure only one task executes at a time.

3. Implement the execution loop

When a task is added, if not running, start processing. For each task, execute it and wait for completion (if it returns a promise) before moving to the next.

4. Handle asynchronous callbacks

Ensure that if a callback returns a promise, the next task waits for it to resolve. Use async/await or promise chaining to serialize execution.

5. Discuss trade-offs and extensions

Mention that this approach sacrifices parallelism for order. Suggest optional features like error handling, cancellation, or priority if needed.

Key Points to Mention

  • Queue data structure to maintain registration order
  • Serial execution using a running flag or promise chain
  • Handling both synchronous and asynchronous callbacks
  • Trade-off between order guarantee and concurrency
  • Error handling and task cancellation as potential extensions
  • Testing with varying delays to verify order

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