본문 바로가기
알고리즘/소스코드

PROGRAMMERS 49993: 스킬트리

by cjw.git 2021. 1. 6.

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) - 10-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

  1.  

 

 

 

cjw.git@gmail.com

댓글