Assume, there is a Data store which stores documents, where each document has a field, documentDate, of string type in the format YYYYMMDDhhmmss.
Assume there is an Api, GetDocumentsCount(string datePrefix), which gets count of the documents where the documentDate starts with the prefix given.
For instance, call to GetDocumentsCount(“201801”) would return count of all the documents where documentDate string starts with 201801.
Write a function, GetDocumentsInRangeCount(string startDateTime, string endDateTime) which would make the minimal number of calls to GetDocumentsCount and fetching exactly the count of documents between the startDateTime and endDateTime , both inclusive.
As an example test case, reply with the minimal number of calls that would be made to GetDocumentsCount when startDateTime is 19700225000000 and the endDateTime is 20190430000000
what will be optimal solution?