Question bank › Binary Search
Dsa Binary Search Hard

Book Availability Search

You are managing a library system that stores the titles of books sorted in alphabetical order. Given an array of strings representing the book titles and a query string, your task is to determine if that book is available in the library. Implement a function that reads the sorted array of book titles and a query title from standard input, and prints 'Available' if the book is found, or 'Not Available' if it is not found. Input Format: - The first line contains an integer n (1 <= n <= 100,000) representing the number of book titles. - The next n lines contain the titles of the books (1 <= length of title <= 100). - The last line contains the query title (1 <= length of title <= 100). Output Format: - Print 'Available' if the book is found, otherwise print 'Not Available'. Example: Input: 5 A Tale of Two Cities Brave New World Catcher in the Rye Moby Dick To Kill a Mockingbird Brave New World Output: Available

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