Skip to content

Commit 2215541

Browse files
author
gyeong-hyeon-kim
committed
Add 1 solution.
1 parent 619b9ab commit 2215541

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

level-2/스킬트리.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//https://github.com/codeisneverodd/programmers-coding-test
2+
//완벽한 정답이 아닙니다.
3+
function solution(skill, skill_trees) {
4+
var answer = 0;
5+
for (const tree of skill_trees) {
6+
let check = Array.from(tree).filter(x => skill.includes(x)).map(x => skill.indexOf(x))
7+
if (checkOrder(check)) answer += 1
8+
}
9+
return answer;
10+
}
11+
12+
function checkOrder(checkArr) {
13+
for (let i = 0; i < checkArr.length; i++) if (checkArr[i] !== i) return false
14+
return true
15+
}

0 commit comments

Comments
 (0)