Dsa
Binary Search
Medium
Event Tickets Availability
A ticketing system has a list of available ticket prices sorted in ascending order. You need to check if specific ticket prices are available for an event.
Input Format:
- The first line contains an integer p (1 <= p <= 10000), the number of available ticket prices.
- The second line contains p space-separated integers representing the sorted ticket prices.
- The third line contains an integer k (1 <= k <= 30), the number of price queries.
- The next k lines each contain one integer representing a ticket price to verify.
Output Format:
- For each query, print "Available" if the ticket price exists, otherwise print "Not Available".
Example:
Input:
5
20 30 55 70 100
3
30
80
20
Output:
Available
Not Available
Available
Key concepts
binary_searcharrayssearching
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