剑指offer python版 数组中数值和下标相等的元素

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]))

 

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