Jeonghyeok Park's Homepage
Living like a machine
-
[Algorithm] GenomicRangeQuery
[Codility] [GenomicRangeQuery] [Code] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(S, P, Q): # write your code in Python 3.6 # print(S, P, Q) cost_dict = {'A':1, 'C':2, 'G':3, 'T':4} curr_counts = [0,0,0,0] counts = [curr_counts[:]] for s in...
-
[Algorithm] PermCheck
[Codility] [PermCheck] [Code] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 import collections def check_duplic(a: list): # print(collections.Counter(a).values(), len(collections.Counter(a).values())) return False if len(set(collections.Counter(a).values())) == 1 else True # print(A) if len(A) ==...
-
[Algorithm] MissingInterger
[Codility] MissingInterger [Code] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 # print(A) A.sort() cnt = 1 if 1 in A: for i in A[A.index(1):]: if i == cnt: cnt+=1 else: return...
-
[Algorithm] MaxCounters
[Codility] MaxCounters [Code] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(N, A): # write your code in Python 3.6 # print(N, A) result = [0]*N max_count = 0 # A가 단일 숫자로 이루어진 경우 (시간복잡도 해결을 위해) if len(set(A))...