First, the dates when Anne had written in her diary can be sorted, although it is not necessary within the given constraint. One way to represent the date is to use a 8-digit integer where:
The most significant four digits indicate the year.
Then, the next two significant digits indicate the month.
The last two digits indicate the day.
Albeit, the dates can be sorted using custom comparators as well.
For each query, it is sufficient to perform a linear search, but the search can be made faster using Binary Search as well.