Skip to content

Commit

Permalink
이슈 #399에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 28, 2024
1 parent c4d92bd commit 13c0ffb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Programmers/전화번호_목록.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

bool solution(vector<string> phone_book) {
sort(phone_book.begin(), phone_book.end());

for (int i = 0; i < phone_book.size() - 1; i++) {
if (phone_book[i + 1].find(phone_book[i]) == 0) {
return false;
}
}

return true;
}

0 comments on commit 13c0ffb

Please sign in to comment.