728x90
https://leetcode.com/problems/finding-the-users-active-minutes
class Solution:
def findingUsersActiveMinutes(self, logs: List[List[int]], k: int) -> List[int]:
result = []
action = {}
for l in logs:
if action.get(l[0], None) is None:
action[l[0]] = set()
action[l[0]].add(l[1])
for i in range(k):
result.append(0)
for key, value in action.items():
result[len(value) - 1] +=1
return result
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 2215. Find the Difference of Two Arrays (0) | 2024.03.03 |
---|---|
[Leetcode] 2418. Sort the People (0) | 2024.03.02 |
[Leetcode] 2657. Find the Prefix Common Array of Two Arrays (1) | 2024.02.28 |
[Leetcode] 2744. Find Maximum Number of String Pairs (0) | 2024.02.26 |
[Leetcode] 2103. Rings and Rods (1) | 2024.02.25 |