Question bank › Binary Search
Dsa Binary Search Medium

Inventory Count

You are managing a store and have a sorted list of product IDs in inventory. Write a function that finds how many items have a product ID less than a given target ID. If there are no such items, return 0. Input Format: A single line with space-separated integers (product IDs) followed by the target ID. Output Format: The count of product IDs that are less than the target ID. Example: Input: 1 3 5 7 9 11 13 15 18 20 10 Output: 5

Key concepts

binary_searchinput_processingsearching

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.