https://app.codility.com/programmers/lessons/4-counting_elements/
정답률: 100% (Task Score 100%, Correctness 100%, Performance 100%)
시간복잡도: O(N) or O(N * log(N))
def solution(A):
_A = set(sorted(A))
answer = 1
for i in _A:
if i > 0 and i <= answer:
answer += 1
else:
continue
return answer
728x90
반응형
'Problem Solving > Codility' 카테고리의 다른 글
[Python] 5.1. CountDiv (0) | 2021.03.15 |
---|---|
[Python] 4.4. PermCheck (0) | 2021.03.15 |
[Python] 4.2. MaxCounters (0) | 2021.03.14 |
[Python] 4.1. FrogRiverOne (0) | 2021.03.13 |
[Python] 3.3. TapeEquilibrium (0) | 2021.03.11 |
댓글