Skip to content

Commit 2c9518f

Browse files
committed
84차 3번 문제 풀이
1 parent b8113ad commit 2c9518f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

live8/test84/문제3/박희경.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def solution(skill, skill_trees):
2+
answer = 0
3+
4+
def is_possible(stack, skill):
5+
i, j = 0, 0
6+
while i < len(stack) and j < len(skill):
7+
if stack[i] == skill[j]:
8+
i += 1
9+
j += 1
10+
else:
11+
return False
12+
return True
13+
14+
for skills in skill_trees:
15+
stack = []
16+
for s in skills:
17+
if s in skill: # 순서가 중요한 스킬만
18+
stack.append(s)
19+
if is_possible(stack, skill):
20+
answer += 1
21+
return answer

0 commit comments

Comments
 (0)