Dsa
Intervals
Hard
Kth Largest Interval
You are given a list of intervals in the format 'start-end'. Write a program to find the Kth largest interval based on its length. The length of an interval is defined as the difference between its end and start. The input will be two lines: The first line contains the intervals; the second line contains the integer K. Example: '1-3 2-5 5-10' and '2' should return '2-5'.
Key concepts
intervalssortingkth largest
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now