def solution(participant, completion):
    # 참가자 dict()
    pmap = dict()
    for p in participant:
        if p in pmap:
            pmap[p] += 1
        else:
            pmap[p] = 1
    # 완주한 사람들 dict()
    for p in completion:
        if p in pmap:
            pmap[p] -= 1
            
    for key, value in pmap.items():
        if value > 0:
            return key

def solution(arr, divisor):
    answer = []
    count = 0
    for i in range(len(arr)):
        if arr[i]%divisor == 0:
            answer.append(arr[i])
            count += 1
            
    if count == 0:
        answer.append(-1)
    return sorted(answer)

 

 

def solution(arr, divisor):
    return sorted([x for x in arr if x%divisor == 0]) or [-1]

def solution(phone_number):
    answer = ""
    answer = "*" * len(phone_number[:-4]) + phone_number[-4:]
    return answer

 

def solution(phone_number):
    return "*" * len(phone_number[:-4]) + phone_number[-4:]

def solution(n):
    answer = []
    answer_list = []
    
    answer_list = list(str(n))
    answer_list = answer_list[::-1] # 역순으로 바꿈
    
    for i in answer_list:
        answer.append(int(i))
    return answer

 

def solution(n):
    return [int(x) for x in str(n)[::-1]]

+ Recent posts