Leetcode 1945 Solution
This article provides solution to leetcode question 1945 (finding-the-users-active-minutes)
Access this page by simply typing in "lcs 1945" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/finding-the-users-active-minutes
Solution
class Solution:
def findingUsersActiveMinutes(self, logs: List[List[int]], k: int) -> List[int]:
m = collections.defaultdict(set)
for user, t in logs:
m[user].add(t)
ans = [0] * k
for user, times in m.items():
ans[len(times) - 1] += 1
return ans