摘要:
def aa(nums,s): i=0 leng=len(nums) ret=[] while i<leng-s+1: ret.append(max(nums[i:i+s])) i +=1 return ret print(aa([2,3,4,2,6,2,5,1],3)) 阅读全文
摘要:
def aa(s,n): #n%=len(s) return s[n:]+s[:n] print(aa('abddh',2)) 阅读全文
摘要:
def aa(string): if not string: return False a=string.split() return ' '.join(a[::-1]) print(aa('I am a engineer.')) 阅读全文
摘要:
def sum_to_s(s): a, b = 1, 2 ret = [] while a < s / 2 + 1: if sum(range(a, b+1)) == s: ret.append(range(a, b+1)) a += 1 elif sum(range(a, b+1)) < s... 阅读全文
摘要:
def aa(nums,s): left,right=0,len(nums)-1 while left s: right -=1 else : left +=1 return None print(aa([1,2,3,4,5],3)) 阅读全文
摘要:
def aa(nums): hashes={} for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in nums: if hashes[s]==1: print (s) return print(... 阅读全文
摘要:
def aa(nums): hashes={} for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in nums: if hashes[s]==1: print (s) return print(... 阅读全文
摘要:
def aa(nums): leng=len(nums) for i in range(leng): if i==nums[i]: print (i) i+=1 return None print(aa([0,1,2,3,4,5])) 阅读全文
摘要:
def aa(nums,n): for i in range(n): if i ==nums[i]: i +=1 else: return i print(aa([0,1,2,3,4,5,7],8)) 阅读全文
摘要:
def aa(nums): if not nums: return False hashes={} ret=[] for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in nums: ret.append([s... 阅读全文