上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 278. First Bad Version# The isBadVersion API is already defined for you.# @param version, an integer# @return a bool# def isBadVersion(version):class 阅读全文
posted @ 2018-08-30 04:53 ffeng0312 阅读(139) 评论(0) 推荐(0)
摘要: class Solution(object): def canWinNim(self, n): """ :type n: int :rtype: bool """ if n%4==0: return False else: return True 阅读全文
posted @ 2018-08-18 05:32 ffeng0312 阅读(111) 评论(0) 推荐(0)
摘要: class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ return list(set( 阅读全文
posted @ 2018-08-15 02:26 ffeng0312 阅读(130) 评论(1) 推荐(0)
摘要: class Solution(object): def addDigits(self, num): """ :type num: int :rtype: int """ sum=num%10 a=num/10 if a >=1: while a > 9: sum += a%10 a=a/10 sum 阅读全文
posted @ 2018-08-14 00:15 ffeng0312 阅读(118) 评论(0) 推荐(0)
摘要: class Solution(object): def findLUSlength(self, a, b): """ :type a: str :type b: str :rtype: int """ if len(a) == len(b): if a <> b: return len(a) els 阅读全文
posted @ 2018-08-01 06:44 ffeng0312 阅读(100) 评论(0) 推荐(0)
摘要: def isUgly(num): """ :type num: int :rtype: bool """ if num>0: if num in [1,2,3,5]: return True else: res =True for i in [2,3,5]: if num%i==0: res = i 阅读全文
posted @ 2018-07-21 02:53 ffeng0312 阅读(116) 评论(0) 推荐(0)
摘要: 217. Contains Duplicateclass Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ freq = {} result = False 阅读全文
posted @ 2018-07-12 07:13 ffeng0312 阅读(169) 评论(1) 推荐(0)
摘要: 205. Isomorphic Stringsclass Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ mapping={} result = True f 阅读全文
posted @ 2018-07-12 05:49 ffeng0312 阅读(133) 评论(0) 推荐(0)
摘要: class Solution(object): def trailingZeroes(self, n): """ :type n: int :rtype: int """ if n==0: return 0 else: return n/5 + self.trailingZeroes(n/5) 阅读全文
posted @ 2018-07-03 23:36 ffeng0312 阅读(83) 评论(0) 推荐(0)
摘要: 268. Missing Numberclass Solution(object): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ n=len(nums) return sum(range(n+1)) 阅读全文
posted @ 2018-06-28 03:41 ffeng0312 阅读(147) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 下一页