https://app.codility.com/programmers/lessons/4-counting_elements/
Task Score 100%
Correctness 100%
Performance 100%
시간복잡도 O(N) or O(N * log(N))
def solution(A):
_A = sorted(A)
_B = range(1,len(A)+1)
answer = 1
for i in range(len(A)):
if _B[i] == _A[i]:
pass
else:
answer = 0
return answer
return answer
728x90
반응형
'Problem Solving > Codility' 카테고리의 다른 글
[Python] 5.2. GenomicRangeQuery (0) | 2021.03.16 |
---|---|
[Python] 5.1. CountDiv (0) | 2021.03.15 |
[Python] 4.3. MissingInteger (0) | 2021.03.15 |
[Python] 4.2. MaxCounters (0) | 2021.03.14 |
[Python] 4.1. FrogRiverOne (0) | 2021.03.13 |
댓글