Greedy intervals: Return the minimum number of points needed so that every closed interval contains at least one chosen point.
Input: A JSON object { "intervals": [number, number][] }.
Output: A JSON integer minimum point count.
Constraints:
- 0 <= intervals.length <= 100000
- Every interval satisfies start <= end
- Intervals are closed, so a shared endpoint can cover both
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: MEDIUM. Variant: 20. Expect follow-up questions about complexity, edge cases, and alternative approaches.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked medium difficulty.
The signed-in workspace provides the tools required by the round, such as recording, code