Link : programmers.co.kr/learn/courses/30/lessons/49993
Python
더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
def solution(skill, skill_trees):
skill_data = dict()
counter = 0
for i in range(len(skill) - 1, 0, -1):
skill_data[skill[i]] = skill[i - 1]
for data in skill_trees:
stack = []
for i in data:
if i in skill_data:
if skill_data[i] in stack:
stack.append(i)
else:
break
else:
stack.append(i)
else:
counter += 1
return counter
|
cs |
FeedBack
cjw.git@gmail.com
'알고리즘 > 소스코드' 카테고리의 다른 글
PROGRAMMERS 12953: N개의 최소공배수 (0) | 2021.01.06 |
---|---|
PROGRAMMERS 68645: 삼각 달팽이 (0) | 2021.01.06 |
PROGRAMMERS 43162: 네트워크 (0) | 2021.01.06 |
PROGRAMMERS 42860: 조이스틱 (0) | 2021.01.06 |
PROGRAMMERS 43238: 입국 심사 (0) | 2021.01.05 |
댓글