728x90
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool solution(vector<string> phone_book) {
bool answer = true;
sort(phone_book.begin(), phone_book.end());
for(int i = 0 ; i < phone_book.size() - 1;i++)
{
if (phone_book[i] == phone_book[i+1].substr(0, phone_book[i].length()))
answer = false;
}
return answer;
}
728x90
'Archive' 카테고리의 다른 글
codeup 1002 (0) | 2020.11.20 |
---|---|
codeup 1001 (0) | 2020.11.20 |
프로그래머스_탑_C++ (0) | 2020.04.08 |
Data Overfitting & Underfitting (0) | 2020.04.02 |
데이터의 종류들 (0) | 2020.04.02 |