diff --git "a/mong3125/\355\225\264\354\213\234.P_\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.java" "b/mong3125/\355\225\264\354\213\234.P_\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.java" new file mode 100644 index 0000000..ebebf49 --- /dev/null +++ "b/mong3125/\355\225\264\354\213\234.P_\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.java" @@ -0,0 +1,20 @@ +import java.util.HashSet; + +class Solution { + public boolean solution(String[] phone_book) { + + HashSet set = new HashSet<>(); + + for (String phoneNum : phone_book) { + set.add(phoneNum); + } + + for (String phoneNum : phone_book) { + for (int i = 0; i < phoneNum.length(); i++) { + if (set.contains(phoneNum.substring(0, i))) return false; + } + } + + return true; + } +} \ No newline at end of file