摘要: def searchInsert(nums, target): for i in nums: if i>=target: return nums.index(i) if nums[0]>=target: return 0 else: return len(nums) 阅读全文
posted @ 2018-05-14 22:18 Python从入门到放弃第一集 阅读(3005) 评论(0) 推荐(0) 编辑
摘要: def strStr(haystack,needle): len1=len(needle) if len1==0: return 0 for i in range(len(haystack)): if haystack[i:i+len1]==needle: return i return -1 阅读全文
posted @ 2018-05-14 22:06 Python从入门到放弃第一集 阅读(2064) 评论(0) 推荐(0) 编辑
摘要: def removeElement(nums, val): c=len(nums) c2=len(nums)-nums.count(val) for i in range(nums.count(val)): nums.remove(val) return c2 阅读全文
posted @ 2018-05-14 13:47 Python从入门到放弃第一集 阅读(2179) 评论(0) 推荐(0) 编辑