Question bank › Binary Search
Dsa Binary Search Hard

Deadline Task Identifier

You are managing a team's task deadlines represented as a sorted array. Each task has a deadline and you want to determine the first task that has a deadline that is greater than or equal to a specified time. Return the 1-based index of such a task. If no such task exists, return -1. Input format: - The first line contains an integer n (1 <= n <= 10000): the number of tasks. - The second line contains n integers representing task deadlines sorted in non-decreasing order (1 <= deadlines[i] <= 10000). - The third line contains an integer time (1 <= time <= 10000): the specified time. Output format: - A single integer representing the 1-based index of the first task whose deadline is greater than or equal to the specified time or -1 if not found. Example: Input: 4 1 3 5 7 4 Output: 3

Key concepts

binary_searcharrayssearching

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.