public int[] findingUsersActiveMinutes(int[][] logs, int k) {
Map<Integer, Set<Integer>> d = new HashMap<>();
for (var log : logs) {
int i = log[0], t = log[1];
d.computeIfAbsent(i, key -> new HashSet<>()).add(t);
}
int[] ans = new int[k];
for (var ts : d.values()) {
++ans[ts.size() - 1];
}
return ans;
}
2023.1.20-----leetcode.1817
最新推荐文章于 2024-08-25 18:17:58 发布