• + 0 comments

    Typescript minimal solution (I had to fix the function since it missed the width param):

    function serviceLane(cases: number[][], width: number[]): number[] {
        const results = [].constructor(cases.length);
        cases.forEach((c, index) => {
            results[index] = width[c[0]];
            for (let i = c[0]; i <= c[1]; i++) {
                if (results[index] > width[i]) results[index] = width[i];
            }
        });
        return results;
    }