301. 호텔 방 배정

아현·2021년 9월 10일
0

Algorithm

목록 보기
315/400
post-custom-banner

프로그래머스


import sys
sys.setrecursionlimit(100000)

def find(number, room):
    if number not in room:
        room[number] = number + 1
        #print(number)
        #print(room)
        return number
    
    empty = find(room[number], room)
    room[number] = empty + 1
    return empty
    #print(empty)
    #print(room)
    
def solution(k, room_number):
    answer = []
    
    dic = {}
    
    for i in room_number:
        num = find(i, dic)
        answer.append(num)
    #print(dic)
    return answer
profile
For the sake of someone who studies computer science
post-custom-banner

0개의 댓글