Twitter 店面挂经

Given a list of tweet names and their recorded times in long, return long[] for the frequency between startTime and endTime given. ( group by frequency)


tweet1 : 1574819311002, 1574819311003, 1574819311004, 1674819311002
tweet2 : 1474819311002, 1374819311002
tweet3 : 1774819311002, 1774819311015, 1874819311002
(input can be assumed as a Map<String, List<Long>> that maintains above relation)

In that some of the times in millis given are hour, minutes and day apart. Given an enum,

enum Frequency { MINUTE, HOUR, DAY }
Implement following function that essentially is a group by of tweet name by time frequency given as input.

long[] getTweetCount(Frequency f, String tweetName, long startTime, long endTime)

Should give output something like this: [2, 1, 3]