- 난이도: Lv2
프로그래머스 링크: https://school.programmers.co.kr/learn/courses/30/lessons/49993
풀이 링크(GitHub): hayannn/CodingTest_Java/프로그래머스/2/스킬트리
풀이 시간 : 24분
class Solution {
public int solution(String skill, String[] skill_trees) {
int count = 0;
for (String tree : skill_trees) {
StringBuilder filtered = new StringBuilder();
for (char c : tree.toCharArray()) {
if (skill.indexOf(c) != -1) {
filtered.append(c);
}
}
if (skill.startsWith(filtered.toString())) {
count++;
}
}
return count;
}
}