Solve Leetcode Problems and Get Offers From Your Dream Companies

Problem 1348. Tweet Counts Per Frequency.

Nil Madhab
LeetCode Simplified

--

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 recorded time (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 on freq) starting from the startTime (in seconds) and ending at the endTime (in seconds).
  • freq is always minute, hour or day, representing the time interval to get the total number of occurrences for the given tweetName.
  • The first time interval always starts from the startTime, so the time intervals are [startTime, startTime + delta*1>, [startTime

--

--

Nil Madhab
LeetCode Simplified

Developer @Booking.com | ex: Samsung, OYO | IIT Kharagpur | Entrepreneur, founder of simplecoding.dev | JOIN Medium, https://nilmadhab.medium.com/membership