import java.util.*;
class Solution {
public boolean solution(String[] phone_book) {
boolean answer = true;
Map<String, Integer> hash = new HashMap<>();
for (int i = 0; i < phone_book.length; i++) hash.put(phone_book[i], i);
for (String number : phone_book) {
for (int i = 1; i < number.length(); i++) {
String prefix = number.substring(0, i);
if (hash.containsKey(prefix)) answer = false;
}
}
return answer;
}
}
유익한 자료 감사합니다.