There was a long question where some data processing was required which would eventually lead to an array of dates and we need to find the number of 3 continuous dates in this array.
For example: array (MM/DD) = [03/19, 03/20, 03/21, 03/20, 05/03, 06/03, 05/04, 07/10, 05/05, 03/19]
Output will be 2 as [03/19 , 03/20, 03/21] and [05/03, 05/04, 05/05] are 3 continuous dates. We have to ignore duplicates.
I solved this problem by sorting and even though it will give correct answer, the interviewer was expecting something else.
Can somone suggest how to approach this problem? Is it similar to 334. Increasing Triplet Subsequence ?? In our case ordering doesn't matter though and we need to take care of duplicates too. The 3 continuous dates need not be contiguous