[codility] frog river one (python)
728x90
반응형
1 ~ x까지 나오면 현재의 인덱스(초)를 리턴해준다
O(n)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import collections
def solution(X, A):
# write your code in Python 3.6
dict=collections.defaultdict(int)
for i,e in enumerate(A):
dict[e]=1
if len(dict)==X:
return i
return -1
728x90
반응형
'codility' 카테고리의 다른 글
[codility] Solution to Binary-Gap by codility (python) (0) | 2020.10.14 |
---|---|
[codility] perm missing elem (python) (0) | 2020.10.14 |
[Codility] lession2 - OddOccurrencesInArray (python, bitwise) (0) | 2020.10.14 |
[코딜리티] passing cars (python) (0) | 2020.09.24 |
lesson 2. cyclicrotation (0) | 2020.09.18 |
TAGS.