Dsa
Binary Search
Easy
Library Archive Search
You need to find if a book with a specific ISBN number exists in a library archive. The library's ISBN list is sorted in ascending order. If the ISBN exists, return 'Exists'; otherwise, return 'Does not exist'.
Input:
The first line contains an integer n (1 <= n <= 1000), the number of books.
The next n lines contain the ISBN numbers as strings (digits only).
The last line contains the ISBN to search for.
Output:
Print 'Exists' or 'Does not exist'.
Example:
Input:
5
000111222
000222333
000333444
000444555
000555666
000222333
Output:
Exists
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