We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8113ad commit 2c9518fCopy full SHA for 2c9518f
1 file changed
live8/test84/문제3/박희경.py
@@ -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