phones holds numbers as strings of digits. The exchange connects a call as soon as the dialled digits match a whole number, so a number that begins with another number can never be reached.
Return True if no number in the list is a prefix of another number in the list, and False otherwise. A number listed twice also counts as a conflict.phones=["112", "911", "9112"] → False
"9112" starts with "911", so the answer is False.
phones=["5550", "5551", "0555"] → True
No number is the beginning of another one.
phones=["42", "42"] → False
Duplicates count too: each one is the beginning of the other.
phones=["112", "911", "9112"]
False
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.