摘要:
class Solution(object): def findDuplicate(self, paths): """ :type paths: List[str] :rtype: List[List[str]] """ content_path={} for i in paths: splits= 阅读全文
摘要:
class Solution(object): def subseq(self,w1,w2): cnt=0 for i in w2: if cnt<len(w1) and i==w1[cnt]: cnt+=1 return cnt==len(w1) def findLUSlength(self, s 阅读全文
摘要:
class Solution(object): def findLHS(self, nums): """ :type nums: List[int] :rtype: int """ cnt={} for num in nums: if num not in cnt: cnt[num]=1 else: 阅读全文
摘要:
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ sub='' longest='' for i in s: if i not in sub: sub+=i 阅读全文
摘要:
class Solution(object): def numRabbits(self, answers): """ :type answers: List[int] :rtype: int """ cnt = {} for answer in answers: if answer not in c 阅读全文
摘要:
class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ l = len(nums) for i in range(l): 阅读全文