-
-
Save HongzCloud/5838f198312d25afcbc6ad79da4b2229 to your computer and use it in GitHub Desktop.
PhoneNumberList_baekjoon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let repeatNum = Int(readLine()!)! | |
for i in 0..<repeatNum { | |
let testCount = Int(readLine()!)! | |
var answer = true | |
var numbers = [String]() | |
for j in 0..<testCount { | |
let number = readLine()! | |
numbers.append(number) | |
} | |
numbers.sort() | |
a: for i in 0..<numbers.count-1 { | |
if numbers[i + 1].hasPrefix(numbers[i]) { | |
answer = false | |
break a | |
} | |
} | |
answer == false ? print("NO") : print("YES") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment