Sorting by start time picks a long meeting that blocks two short ones.
Acceptance criteria
- 1.#out should show attend 2.
Sorting by start time picks a long meeting that blocks two short ones.
const meetings = [[1, 10], [2, 3], [4, 5]]; meetings.sort((a, b) => a[0] - b[0]); let count = 0, endsAt = -Infinity; for (const [from, to] of meetings) if (from >= endsAt) { count++; endsAt = to; } document.querySelector('#out').textContent = "attend " + count;
Output ready when you are
Press Run to render your code, or Submit to validate your solution.