Skip to content

Commit

Permalink
[level 2] Title: 스킬트리, Time: 0.01 ms, Memory: 10 MB -BaekjoonHub
Browse files Browse the repository at this point in the history
  • Loading branch information
srlee056 committed May 9, 2024
1 parent 8ddf4a8 commit 6dcbade
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
4 changes: 2 additions & 2 deletions 프로그래머스/2/49993. 스킬트리/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### 성능 요약

메모리: 10.1 MB, 시간: 0.02 ms
메모리: 10 MB, 시간: 0.01 ms

### 구분

Expand All @@ -16,7 +16,7 @@

### 제출 일자

2023년 10월 6일 22:8:15
2024년 05월 09일 13:23:53

### 문제 설명

Expand Down
31 changes: 11 additions & 20 deletions 프로그래머스/2/49993. 스킬트리/스킬트리.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@
def solution(skill, skill_trees):

count = 0

for skill_tree in skill_trees:
curr = 0
hasAppeared = {k : False for k in skill}

for s in skill_tree:
if s in hasAppeared:

hasAppeared[s] = True
if curr < len(skill) and s == skill[curr]:
curr += 1

#print(hasAppeared)
#print(curr, [k for k, x in hasAppeared.items() if x])
if curr == len( [k for k, x in hasAppeared.items() if x]):

cur_idx = 0
is_valid = True
for skill_ in skill_tree:
if skill_ in skill:
if skill_ != skill[cur_idx]:
is_valid = False
break
else:
cur_idx += 1
if is_valid:
count += 1






return count

0 comments on commit 6dcbade

Please sign in to comment.