← Sigmacomputing Interview Insights

Sigmacomputing·Frontend Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

JS coding round at Sigmacomputing for a frontend role. The main problem was a task manager class and it had a few follow-ups that pushed into promise chaining and ordering logic. Not the hardest thing I've done but the follow-ups added up fast.

Questions Asked (2)

Q1

Implement a task manager class that runs callbacks in the order they were called, even if the callbacks themselves have different execution delays. For example, if run_task(task2) is called before run_task(task1), task2 should execute first regardless of its timeout.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The core concept clicked pretty quickly for me since it's basically a queue wrapped around promises.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: tasks should execute in the order they are called, regardless of their individual delays. Then, propose a solution using a queue to maintain order and a mechanism to ensure only one task runs at a time, such as a promise chain or a lock. Finally, discuss trade-offs like error handling and concurrency.

Pro tip: Mention that this pattern is similar to a sequential promise queue, and highlight that it ensures deterministic execution order, which is crucial for UI updates and avoiding race conditions.

1. Clarify Requirements

Confirm that tasks should run in the order they are invoked, even if they have different delays, and that only one task should run at a time.

2. Design the Data Structure

Use a queue to store tasks in the order they are called. Each task includes a callback and its delay.

3. Implement Sequential Execution

Use a promise chain or a lock to ensure that the next task starts only after the previous one completes, preserving order.

4. Handle Edge Cases

Consider error handling, cancellation, and dynamic addition of tasks while the queue is running.

5. Discuss Trade-offs

Compare this approach to parallel execution, noting benefits like order guarantee and drawbacks like increased total time.

Key Points to Mention

  • Queue data structure (FIFO) to maintain order
  • Promise chaining or async/await to serialize execution
  • Ensuring only one task runs at a time (mutex/lock)
  • Error handling: how failures affect subsequent tasks
  • Trade-offs: sequential vs parallel execution
  • Use cases: UI updates, avoiding race conditions

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

Q2

Follow-up: modify the task manager so that each run_task call accepts a list of tasks. Tasks within a single list should resolve in order of their timeouts, but the order between separate run_task calls must still be preserved.

Algorithms & Data StructuresSystem Design
Author's notes

This is where things got genuinely tricky.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the concurrency model and the meaning of 'order of timeouts' (e.g., earliest timeout first). Then propose a design that preserves the global order of run_task calls while allowing tasks within a single call to be scheduled by timeout, using a priority queue per call and a global queue for call order.

Pro tip: Mention that you would first confirm whether tasks within a call should run concurrently or sequentially, and whether timeouts are fixed or dynamic; this shows you think about edge cases and avoid over-engineering.

1. Clarify requirements and constraints

Ask about the concurrency model, whether tasks within a call can run in parallel, and how timeouts are defined (e.g., absolute deadlines or relative durations). Confirm that the order between separate run_task calls must be strictly preserved.

2. Design data structures

Use a global FIFO queue to maintain the order of run_task calls. For each call, use a min-heap (priority queue) keyed by timeout to order tasks within that call.

3. Define scheduling algorithm

Process calls in FIFO order. For each call, extract tasks from its min-heap in timeout order and execute them, ensuring that no task from a later call starts before all tasks from the current call are scheduled.

4. Handle concurrency and edge cases

Consider if tasks within a call can run concurrently; if so, use a thread pool or async execution while still respecting timeout order for starting tasks. Handle empty lists, duplicate timeouts, and dynamic timeout changes.

5. Analyze complexity and trade-offs

Discuss time complexity: O(n log n) for sorting tasks within each call, and O(m) for processing m calls. Mention alternative approaches like sorting the list if timeouts are static, and trade-offs between simplicity and performance.

Key Points to Mention

  • Global FIFO queue for run_task calls to preserve inter-call order
  • Min-heap (priority queue) per call to order tasks by timeout
  • Concurrency model: whether tasks within a call run sequentially or in parallel
  • Edge cases: empty task lists, equal timeouts, dynamic timeouts
  • Time complexity: O(n log n) per call due to heap operations
  • Alternative: sorting the list if timeouts are known upfront and static

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