We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static int solution(String skill, String[] skillTrees) { int answer = 0; // [BACDE, CBADF, AECB, BDA] System.out.println(Arrays.toString(skillTrees)); // skill = "CBD"; removeNotContainSkills(skill, skillTrees); // [BCD, CBD, CB, BD] System.out.println(Arrays.toString(skillTrees)); return answer; } private static void removeNotContainSkills(String skill, String[] skillTrees) { // skill에 포함되지 않는 문자 제거 for (int i = 0; i < skillTrees.length; i++) { StringBuilder sb = new StringBuilder(skillTrees[i]); for (int j = 0; j < sb.length(); j++) { char ch = sb.charAt(j); if (isNotContainSkill(skill, ch)) { sb.deleteCharAt(j); j --; } } skillTrees[i] = sb.toString(); } } private static boolean isNotContainSkill(final String str, final char ch) { return str.indexOf(ch) == -1; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
String 배열의 각 요소들이 특정 문자열에서 없는 문자 제거하기(?)
The text was updated successfully, but these errors were encountered: