전화번호부

Archive

프로그래머스_전화번호부_C++

#include #include #include using namespace std; bool solution(vector 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; }

냉국
'전화번호부' 태그의 글 목록