Question bank › Binary Search
Dsa Binary Search Medium

Book Availability Checker

You are given a sorted list of book IDs that are available in a library, and you need to determine if a specific book ID is available or not. Input Format: - The first line contains an integer n (1 <= n <= 100000), the number of books available in the library. - The second line contains n space-separated integers representing the sorted book IDs. - The third line contains a single integer m (1 <= m <= 10000), the number of queries. - The next m lines each contain one integer representing a book ID to check for availability. Output Format: - For each query, print "Yes" if the book ID is available, otherwise print "No". Example: Input: 5 101 203 304 405 506 3 203 508 101 Output: Yes No Yes

Key concepts

binary_searcharrayssorting

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