Tap here to switch tabs
Problem
Submissions

Problem: Finding the Users Active Minutes

Finding the Users Active Minutes uses activity logs to count each user's unique active minutes, then returns how many users have each total from one through k.

Statement

You are given the activity logs of users on a platform and an integer k. The logs are represented by a 2D2\text{D} integer array logs, where each logs[i] =[IDi,timei]= [\text{ID}_i, \text{time}_i] indicates that the user with ID IDi\text{ID}_i performed an action at minute timei\text{time}_i.

Multiple users can perform actions simultaneously, and a single user can perform multiple actions in the same minute.

The User Active Minutes (UAM) for a user is defined as the number of unique minutes during which the user performed at least one action. Even if a user performs multiple actions within the same minute, that minute is only counted once toward their UAM.

Return a 1-indexed1\text{-indexed} integer array answer of size k such that, for each jj (1≤j≤1 \leq j \leq k), answer[j - 1] is the number of users whose UAM is equal to jj.

Constraints:

  • 1≤1 \leq logs.length ≤104\leq 10^4

  • 0≤IDi≤1090 \le \text{ID}_i \le 10^9

  • 1≤timei≤1051 \le \text{time}_i \le 10^5

  • k is in the range [maximum UAM of any user,105][\text{maximum UAM of any user}, 10^5]

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Finding the Users Active Minutes

Finding the Users Active Minutes uses activity logs to count each user's unique active minutes, then returns how many users have each total from one through k.

Statement

You are given the activity logs of users on a platform and an integer k. The logs are represented by a 2D2\text{D} integer array logs, where each logs[i] =[IDi,timei]= [\text{ID}_i, \text{time}_i] indicates that the user with ID IDi\text{ID}_i performed an action at minute timei\text{time}_i.

Multiple users can perform actions simultaneously, and a single user can perform multiple actions in the same minute.

The User Active Minutes (UAM) for a user is defined as the number of unique minutes during which the user performed at least one action. Even if a user performs multiple actions within the same minute, that minute is only counted once toward their UAM.

Return a 1-indexed1\text{-indexed} integer array answer of size k such that, for each jj (1≤j≤1 \leq j \leq k), answer[j - 1] is the number of users whose UAM is equal to jj.

Constraints:

  • 1≤1 \leq logs.length ≤104\leq 10^4

  • 0≤IDi≤1090 \le \text{ID}_i \le 10^9

  • 1≤timei≤1051 \le \text{time}_i \le 10^5

  • k is in the range [maximum UAM of any user,105][\text{maximum UAM of any user}, 10^5]