剑指offer python版 股票最大收益

def aa(nums):
    a,b=0,1
    ret=[]
    leng=len(nums)
    for  i in range(leng-1):
        for  j in range(i+1,leng):
            ret.append(nums[j]-nums[i])
            
                
    return max(ret)


print(aa([9,11,8,5,7,12,16,14]))

 

posted @ 2018-10-29 16:08  findtruth123  阅读(405)  评论(0编辑  收藏  举报