From fbea6dde9f673bd216dbf4ce1ce7416cb4928f1e Mon Sep 17 00:00:00 2001 From: rimogsu Date: Tue, 17 Nov 2026 22:47:26 +0900 Subject: [PATCH] 1348,1536 --- .../v4/1348. Tweet Counts Per Frequency.py" | 35 +++++++++++++++++++ ...Minimum Swaps to Arrange a Binary Grid.py" | 6 ++++ 2 files changed, 41 insertions(+) create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v4/1348. Tweet Counts Per Frequency.py" create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v4/1536. Minimum Swaps to Arrange a Binary Grid.py" diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1348. Tweet Counts Per Frequency.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1348. Tweet Counts Per Frequency.py" new file mode 100644 index 00000000..d9d06b5f --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1348. Tweet Counts Per Frequency.py" @@ -0,0 +1,35 @@ +from collections import defaultdict +class TweetCounts: + + def __init__(self): + self.dic = defaultdict(list) + + def recordTweet(self, tweetName: str, time: int) -> None: + self.dic[tweetName].append(time) + if tweetName == 'tweet2' and 807230331 <= time <= 807231513: + print(time) + + def getTweetCountsPerFrequency(self, freq: str, tweetName: str, startTime: int, endTime: int) -> list[int]: + mode = { + 'minute': 60, + 'hour': 3600, + 'day': 86400 + } + + curr = startTime + lst = [] + while curr <= endTime: + end = curr + mode[freq] + num = 0 + for elem in self.dic[tweetName]: + if curr <= elem < end and elem <= endTime: + num += 1 + curr = end + lst.append(num) + + return lst + +# Your TweetCounts object will be instantiated and called as such: +# obj = TweetCounts() +# obj.recordTweet(tweetName,time) +# param_2 = obj.getTweetCountsPerFrequency(freq,tweetName,startTime,endTime) \ No newline at end of file diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1536. Minimum Swaps to Arrange a Binary Grid.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1536. Minimum Swaps to Arrange a Binary Grid.py" new file mode 100644 index 00000000..142a2365 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v4/1536. Minimum Swaps to Arrange a Binary Grid.py" @@ -0,0 +1,6 @@ +''' +시간부족 +''' +class Solution: + def minSwaps(self, grid: list[list[int]]) -> int: + \ No newline at end of file