Dsa
Binary Search
Medium
Find Missing Work Hour
You are given a list of recorded work hours of an employee for the week. The hours are sorted in ascending order but one entry is missing due to a clerical error. Your task is to identify the missing hour that should fit in the sorted list. If the list is complete, return -1.
Input Format:
- The first line contains a single integer N, the number of recorded hours.
- The second line contains N space-separated integers representing the sorted working hours.
Output Format:
- Print the missing hour if found, otherwise -1.
Example:
Input:
5
1 2 3 4 6
Output:
5
Key concepts
binary_searchwork_hoursarrays
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