Sequential Task Execution API

Company: Quicksell_13nov

Difficulty: medium

Problem Statement

Sequential Task Execution API Problem Description In the original assessment you implement async function runSequentially(functions) : functions is an array of functions that each return a Promise, and runSequentially must run them one after another (the next one starts only after the previous one has settled), resolve with the array of their results in the original order, and reject as soon as one of them throws. The test harness built functions from incrementCounterAsync , a task that adds 1 to a shared counter and resolves with the new value, so a starting counter of 1 with two such tasks gives [2, 3] . The same logic is exposed as an API endpoint: POST /api/tasks/run-sequentially The request body is a JSON object: initialValue (integer, optional): the starting value of the counter for this request. If the field is absent the counter starts at 1 . tasks (array, required): the tasks to run, in order. Each task has: action (string, required): "increment" adds 1 to the counter and the