From f938fbfe8787d849f4d57deda885617d2183aafb Mon Sep 17 00:00:00 2001 From: oheunhyuck <71165142+oheunhyuck@users.noreply.github.com> Date: Tue, 17 Nov 2026 22:50:50 +0900 Subject: [PATCH 1/3] Create 1536. Minimum Swaps to Arrange a Binary Grid --- ...6. Minimum Swaps to Arrange a Binary Grid" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "leetcode3/\354\230\244\354\235\200\355\230\201/1536. Minimum Swaps to Arrange a Binary Grid" diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/1536. Minimum Swaps to Arrange a Binary Grid" "b/leetcode3/\354\230\244\354\235\200\355\230\201/1536. Minimum Swaps to Arrange a Binary Grid" new file mode 100644 index 00000000..fcf943fa --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/1536. Minimum Swaps to Arrange a Binary Grid" @@ -0,0 +1,32 @@ +class Solution: + + def is_poss(self,grid,y,need): + for x in range(len(grid)-need,len(grid) ): + if grid[y][x]==1:return False + return True + def swap(self,grid,a,b): + temp=grid[a] + grid[a]=grid[b] + grid[b]=temp + + + + def minSwaps(self, grid: list[list[int]]) -> int: + n=len(grid) + ans=0 + for y in range(n): + need=n-(y+1) + target=-1 + for ny in range(y,n): + if self.is_poss(grid,ny,need): + target=ny + break + if target==-1:return -1 + while target>y: + ans+=1 + self.swap(grid,target,target-1) + target-=1 + + return ans + + From 1cfcb995b2c67c3b1963d86dbc31c3866068aa2e Mon Sep 17 00:00:00 2001 From: oheunhyuck <71165142+oheunhyuck@users.noreply.github.com> Date: Tue, 17 Nov 2026 22:51:20 +0900 Subject: [PATCH 2/3] Create 1348. Tweet Counts Per Frequency --- .../1348. Tweet Counts Per Frequency" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "leetcode3/\354\230\244\354\235\200\355\230\201/1348. Tweet Counts Per Frequency" diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/1348. Tweet Counts Per Frequency" "b/leetcode3/\354\230\244\354\235\200\355\230\201/1348. Tweet Counts Per Frequency" new file mode 100644 index 00000000..e90c566e --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/1348. Tweet Counts Per Frequency" @@ -0,0 +1,40 @@ +class TweetCounts: + + def __init__(self): + self.tweets={} + self.time_dict={"minute":60,"hour":3600,"day":86400} + + + def recordTweet(self, tweetName: str, time: int) -> None: + if tweetName in self.tweets: + + self.tweets[tweetName].append(time) + else: + self.tweets[tweetName]=[time] + + + def getTweetCountsPerFrequency(self, freq: str, tweetName: str, startTime: int, endTime: int) -> list[int]: + self.ans=[] + + while startTime<=endTime: + cnt=0 + for a in self.tweets[tweetName]: + if a>=startTime and a<=startTime+self.time_dict[freq]-1: + cnt+=1 + self.ans.append(cnt) + + + startTime+=self.time_dict[freq] + return self.ans + + + + + + + + +# Your TweetCounts object will be instantiated and called as such: +# obj = TweetCounts() +# obj.recordTweet(tweetName,time) +# param_2 = obj.getTweetCountsPerFrequency(freq,tweetName,startTime,endTime) From e7ecd9bb1a414d5f9afc47efbf9ecd650bf37811 Mon Sep 17 00:00:00 2001 From: oheunhyuck <71165142+oheunhyuck@users.noreply.github.com> Date: Wed, 18 Nov 2026 06:54:13 +0900 Subject: [PATCH 3/3] Create 1696. Jump Game VI --- .../1696. Jump Game VI" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "leetcode3/\354\230\244\354\235\200\355\230\201/1696. Jump Game VI" diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/1696. Jump Game VI" "b/leetcode3/\354\230\244\354\235\200\355\230\201/1696. Jump Game VI" new file mode 100644 index 00000000..f734b044 --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/1696. Jump Game VI" @@ -0,0 +1,18 @@ +import heapq +class Solution: + def maxResult(self, nums: list[int], k: int) -> int: + hq=[] + dp=[0]*len(nums) + dp[0]=nums[0] + heapq.heappush(hq,(-dp[0],0)) + for i in range(1,len(nums)): + while hq and hq[0][1]