Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort the queries.
We need to greedily pick the queries with farthest ending point first.
Solve with full IDE support and test cases