File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 44
55### 성능 요약
66
7- 메모리: 97.1 MB, 시간: 320.08 ms
7+ 메모리: 163 MB, 시간: 520.93 ms
88
99### 구분
1010
1616
1717### 제출 일자
1818
19- 2025년 07월 14일 11:27:40
19+ 2025년 09월 01일 14:53:05
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change 11import java .util .*;
22class Solution {
3- public boolean solution (String [] s ) {
4- Arrays .sort (s ); // 사전순 정렬
5- for (int i = 0 ; i <s .length -1 ; i ++){
6- if (s [i +1 ].startsWith (s [i ])) return false ;
3+ public boolean solution (String [] phone_book ) {
4+ String [] answer = new String [phone_book .length ];
5+ int i =0 ;
6+ for (String number : phone_book ){
7+ answer [i ++] = number .replaceAll (" " ,"" );
8+ }
9+ Arrays .sort (answer );
10+
11+ for (int idx = 1 ;idx < answer .length ;idx ++) {
12+ String period = answer [idx -1 ];
13+ String current = answer [idx ];
14+
15+ if (current .startsWith (period )){
16+ return false ;
17+ }
718 }
819 return true ;
920 }
You can’t perform that action at this time.
0 commit comments