목록Algorithms/Stack and Queue (1)
Programmers - 스킬트리 [파이썬]
from collections import deque def solution(skill, skill_trees): answer = 0 for i in skill_trees: temp = deque() for j in i: if j in skill: temp.append(j) cnt = 0 n = len(temp) temp2 = deque(skill) while temp: if temp.popleft() == temp2.popleft(): cnt+=1 if cnt == n: answer+=1 return answer # cnt 와 n 비교를 while 문안에서 실행해서 실패 발생한 것 수정 ############# 다른사람 풀이 ############# def solution(skill, skill_tre..
Algorithms/Stack and Queue
2020. 5. 19. 00:34