We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
People have already said this, but to reiterate, in order to write this function propery you need to adjust the call:
const result = serviceLane(width, cases);
That is for JS, but it seems like other languages have a similar issue. It also appears (based on the examples given) that the case indexes are 1-based, but in fact they are 0-based. Easy one liner solution once that is fixed:
Service Lane
You are viewing a single comment's thread. Return to all comments →
People have already said this, but to reiterate, in order to write this function propery you need to adjust the call:
const result = serviceLane(width, cases);
That is for JS, but it seems like other languages have a similar issue. It also appears (based on the examples given) that the case indexes are 1-based, but in fact they are 0-based. Easy one liner solution once that is fixed:
const serviceLane = (width, cases) => cases.map(curCase => Math.min(...width.slice(curCase[0], curCase[1] + 1)));