[codility]PermCheck

来源:互联网 发布:elliott smith 知乎 编辑:程序博客网 时间:2024/06/06 05:44

Python代码如下:

def solution(A):    # write your code in Python 2.6    checkTable = [False]*len(A)    for value in A:        if value < 1 or value > len(A):            return 0        checkTable[value-1] = True        for flag in checkTable:        if not flag:            return 0        return 1    pass


0 0
原创粉丝点击