Dsa
Binary Search
Easy
Event Date Search
A company has organized a series of events on specific dates within a year. Given a sorted list of event dates, you need to check for the existence of a certain event date. If found, print "Event scheduled"; if not, print "No event".
Input:
First line: an integer n (1 <= n <= 1000), the number of events
Next n lines: dates in the format YYYY-MM-DD
Last line: a date to search for in the same format.
Output:
Print either 'Event scheduled' or 'No event'.
Example:
Input:
5
2023-01-10
2023-02-14
2023-03-01
2023-05-22
2023-07-04
2023-05-22
Output:
Event scheduled
Key concepts
binary_searchdatessearching
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