討論串[閒聊] 每日leetcode
共 1548 篇文章
內容預覽:
subseq只會有三種情況. 全偶. 全奇. 奇偶交錯. 三個都囚出來就可以了. def maximumLength(self, nums: List[int]) -> int:. resi = [x%2 for x in nums]. a, b = resi.count(0), resi.coun
(還有87個字)
內容預覽:
姆咪==. 一二三四五. def isValid(self, word: str) -> bool:. return len(word)>=3 and all([ord('0')<=ord(c)<=ord('9') or ord('A')<=ord(c)<=ord('Z') or ord('a')<
(還有280個字)
內容預覽:
今天的每日寫過了. 改寫別題. 1234. Replace the Substring for Balanced String. 先算出Q、W、E、R各自的數量. 再算已經平衡的組數、還沒平衡的組數. 接著把Q、W、E、R各自的數量 - 已經平衡的組數. 如果 > 0那就是多餘的字母,可以替換成別的
(還有1488個字)
內容預覽:
好像就greedy嚕過去吧 嗎. 不知道有沒有其他方法. 懶得看了. 一二三四五. def matchPlayersAndTrainers(self, players: List[int], trainers: List[int]) ->int:. players.sort(). trainers.
(還有262個字)