Solve Leetcode Problems and Get Offers From Your Dream Companies
Problem 1348. Tweet Counts Per Frequency.
In this series, I am going to solve Leetcode medium problems live with my friend, which you can see on our youtube channel, Today we will do Problem Problem 1348. Tweet Counts Per Frequency.
A little bit about me, I have offers from Uber India and Amazon India in the past, and I am currently working for Booking.com in Amsterdam.
Problem Statement
Implement the class TweetCounts
that supports two methods:
1. recordTweet(string tweetName, int time)
- Stores the
tweetName
at the recordedtime
(in seconds).
2. getTweetCountsPerFrequency(string freq, string tweetName, int startTime, int endTime)
- Returns the total number of occurrences for the given
tweetName
per minute, hour, or day (depending onfreq
) starting from thestartTime
(in seconds) and ending at theendTime
(in seconds). freq
is always minute, hour or day, representing the time interval to get the total number of occurrences for the giventweetName
.- The first time interval always starts from the
startTime
, so the time intervals are[startTime, startTime + delta*1>, [startTime
…