Finding the Users Active Minutes LeetCode solution in JavaScript

1
var findingUsersActiveMinutes = function (logs, k) {
2
const map = new Map();
3

4
for (const [userID, minute] of logs) {
5
if (!map.has(userID)) map.set(userID, new Set());
6
map.get(userID).add(minute);
7
}
8

9
const count = new Array(k).fill(0);
10

11
for (const actions of map.values()) {
12
count[actions.size - 1]++;
13
}
14

15
return count;
16
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0