Post

๐Ÿฃ ๊ฐœ์ธ์ •๋ณด ์ˆ˜์ง‘ ์œ ํšจ๊ธฐ๊ฐ„

1. ๋ฌธ์ œ ๋งํฌ

2023 KAKAO BLIND RECRUITMENT: ๊ฐœ์ธ์ •๋ณด ์ˆ˜์ง‘ ์œ ํšจ๊ธฐ๊ฐ„


2. ์ฝ”๋“œ

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# time : 9'

def solution(today, terms, privacies):
    answer = []
    today_split = today.split('.')
		# ์˜ค๋Š˜ ๋‚ ์งœ -> ๋…„๋„ ํฌํ•จ date_time์œผ๋กœ ๋ณ€ํ™˜
    date_time_today = int(today_split[0]) * 28 * 12 \
										+ int(today_split[1]) * 28 \
										+ int(today_split[2])
    valid_time = {} # ๋งŒ๋ฃŒ ๊ธฐ๊ฐ„ ํƒ€์ž… ๋”•์…”๋„ˆ๋ฆฌ ํ˜•ํƒœ๋กœ ํŒŒ์‹ฑ

    for t in terms:
        tt = t.split()
        valid_time[tt[0]] = int(tt[1]) * 28

    for p in range(len(privacies)):
        privacies_time, privacies_type = privacies[p].split() # ์‹œ๊ฐ„, ํƒ€์ž… ๋„ฃ์–ด์คŒ
        privacies_split = privacies_time.split('.')
        date_time_p = int(privacies_split[0]) * 28 * 12 \
										+ int(privacies_split[1]) * 28 \
										+ int(privacies_split[2]) \
										+ valid_time[privacies_type]
        if date_time_p <= date_time_today: # ์˜ค๋Š˜ ๋‚ ์งœ ๊ธฐ์ค€ ๋น„๊ต
            answer.append(p + 1)

    return answer



This post is licensed under CC BY 4.0 by the author.