Question bank › Binary Search
Dsa Binary Search Medium

Auction Bid Finder

In an auction system, bids are arranged in ascending order. Given a list of bids and a target bid value, find the highest bid that is less than or equal to the target using binary search. Input format: - The first line contains an integer N, the number of bids. - The second line contains N integers of bid amounts in ascending order. - The third line contains an integer B, the target bid. Output format: - Output the index of the highest bid that is <= target, or -1 if no such bid exists. Example: Input: 5 100 200 300 400 500 350 Output: 2

Key concepts

binary_searchsearch

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.