728x90
https://programmers.co.kr/learn/courses/30/lessons/49993
class Solution {
public static int solution(String skill, String[] skill_trees) {
int answer = 0;
for (String skill_tree : skill_trees) {
int pivot = 0;
boolean checked = true;
for (int i = 0; i < skill_tree.toCharArray().length; i++) {
int item = skill.indexOf(skill_tree.charAt(i));
if (item == -1) {
continue;
} else if (pivot == item) {
pivot++;
} else {
checked = false;
}
}
if(checked) {
answer++;
}
}
return answer;
}
}
문제를 잘 읽자
728x90