Question bank › Binary Search
Dsa Binary Search Easy

Book Price Finder

You are given a list of book prices, which are sorted in ascending order. You need to determine if a specific price exists within that list or not. If it exists, print "Price found!"; if it doesn't, print "Price not found!". Input: First line: an integer n, the number of books (1 <= n <= 1000) Next n lines: each line contains a float representing the price of a book Last line: a float representing the target price to search for Output: Print 'Price found!' or 'Price not found!'. Example: Input: 5 10.99 15.50 20.00 25.75 30.00 15.50 Output: Price found!

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.