leetcode不会-ProblemSolving-LeetCode:问题解决-LeetCode

时间:2024-07-19 21:20:34
【文件属性】:

文件名称:leetcode不会-ProblemSolving-LeetCode:问题解决-LeetCode

文件大小:33KB

文件格式:ZIP

更新时间:2024-07-19 21:20:34

系统开源

leetcode 不会问题解决-LeetCode 破解代码面试: 放: def isUnique ( self , astr ): s = set ( astr ) return len ( s ) == len ( astr ) 残酷:两个循环或签in def isUnique ( self , astr ): for i in range ( len ( astr )): if astr [ i ] in astr [ i + 1 :]: return False return True astr[i] in astr[i+1:]检查astr[i] in astr[i+1:]也在引擎盖下使用嵌套。 布尔数组 def isUnique ( self , astr ): arr = [ 0 ] * 26 for i in range ( len ( astr )): index = ord ( astr [ i ]) - ord ( 'a' ) if arr [ index ] == 1 : return False else : arr [ index ] += 1 return T


【文件预览】:
ProblemSolving-LeetCode-main
----README.md(113KB)

网友评论