[codility]PermCheck

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


你可能感兴趣的:([codility]PermCheck)