๐ฆ ๊ฐ์ธ์ ๋ณด ์์ง ์ ํจ๊ธฐ๊ฐ
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
27
28
29
from dateutil.relativedelta import relativedelta
import datetime
def is_day_after_month(now, date, month):
y1, m1, d1 = map(int, now.split("."))
y2, m2, d2 = map(int, date.split("."))
now = datetime.date(year = y1, month = m1, day = d1)
date = datetime.date(year = y2, month = m2, day = d2)
month = relativedelta(months = month)
if date + month <= now:
return True
return False
def solution(today, terms, privacies):
TERMS = dict()
for term in terms:
alpha, month = term.split()
TERMS[alpha] = int(month)
print(TERMS)
answer = []
for i in range(len(privacies)):
date, term = privacies[i].split()
if is_day_after_month(today, date, TERMS[term]):
answer.append(i + 1)
return answer
- ์ ํ์ฑ
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
์ฑ์ ์ ์์ํฉ๋๋ค.
์ ํ์ฑ ํ
์คํธ
ํ
์คํธ 1 ใ ํต๊ณผ (0.09ms, 11.1MB)
ํ
์คํธ 2 ใ ํต๊ณผ (0.16ms, 11MB)
ํ
์คํธ 3 ใ ํต๊ณผ (0.17ms, 11MB)
ํ
์คํธ 4 ใ ํต๊ณผ (0.11ms, 11.2MB)
ํ
์คํธ 5 ใ ํต๊ณผ (0.16ms, 11.2MB)
ํ
์คํธ 6 ใ ํต๊ณผ (0.35ms, 11.1MB)
ํ
์คํธ 7 ใ ํต๊ณผ (0.18ms, 11.1MB)
ํ
์คํธ 8 ใ ํต๊ณผ (0.22ms, 11.1MB)
ํ
์คํธ 9 ใ ํต๊ณผ (0.59ms, 11.1MB)
ํ
์คํธ 10 ใ ํต๊ณผ (0.78ms, 11.1MB)
ํ
์คํธ 11 ใ ํต๊ณผ (0.74ms, 11.1MB)
ํ
์คํธ 12 ใ ํต๊ณผ (1.81ms, 11.2MB)
ํ
์คํธ 13 ใ ํต๊ณผ (1.85ms, 11.1MB)
ํ
์คํธ 14 ใ ํต๊ณผ (1.06ms, 11.1MB)
ํ
์คํธ 15 ใ ํต๊ณผ (0.64ms, 10.9MB)
ํ
์คํธ 16 ใ ํต๊ณผ (1.51ms, 11MB)
ํ
์คํธ 17 ใ ํต๊ณผ (1.20ms, 11.1MB)
ํ
์คํธ 18 ใ ํต๊ณผ (1.19ms, 11.2MB)
ํ
์คํธ 19 ใ ํต๊ณผ (1.15ms, 11.1MB)
ํ
์คํธ 20 ใ ํต๊ณผ (3.14ms, 10.9MB)
์ฑ์ ๊ฒฐ๊ณผ
์ ํ์ฑ: 100.0
ํฉ๊ณ: 100.0 / 100.0
3. ํด์ค
๊ฐ month ์ ๋ํด ํ๋ฌ์ ๋ํ์ ๊ฒฝ์ฐ today ๋ฅผ ์ด๊ณผํ๋ฉด ์ ๋ต์ผ๋ก ์ถ๋ ฅ
datetime ๊ณผ dateutil ๋ชจ๋์ ์ฌ์ฉํจ
This post is licensed under CC BY 4.0 by the author.