[Question]
  [
In information theory, a "prefix code" is a dictionary where none of the keys are a prefix of another. In other words, this means that none of the strings starts with any of the other. 
For example, `{"9", "55"}` is a prefix code, but `{"5", "9", "55"}` is not.
The biggest advantage of this, is that the encoded text can be written down with no separator between them, and it will still be uniquely decipherable. This shows up in compression algorithms such as [Huffman coding](http://chat.stackexchange.com/transcript/message/29382537#29382537), which always generates the optimal prefix code.
Your task is simple: Given a list of strings, determine whether or not it is a valid prefix code.
Your input:
* Will be a list of strings in any [reasonable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods).
* Will only contain printable ASCII strings.
* Will not contain any empty strings.
Your output will be a [truthy/falsey](https://codegolf.meta.stackexchange.com/questions/2190/interpretation-of-truthy-falsey) value: Truthy if it's a valid prefix code, and falsey if it isn't.
Here are some true test cases:
```
["Hello", "World"]                      
["Code", "Golf", "Is", "Cool"]
["1", "2", "3", "4", "5"]
["This", "test", "case", "is", "true"]          
["111", "010", "000", "1101", "1010", "1000", "0111", "0010", "1011", 
 "0110", "11001", "00110", "10011", "11000", "00111", "10010"]
```
Here are some false test cases:
```
["4", "42"]                             
["1", "2", "3", "34"]                   
["This", "test", "case", "is", "false", "t"]
["He", "said", "Hello"]
["0", "00", "00001"]
["Duplicate", "Duplicate", "Keys", "Keys"]
```
This is code-golf, so standard loopholes apply, and shortest answer in bytes wins.
  
[Answer]
# Pyth, 8 bytes
```
.AxM.PQ2
```
[Test suite](https://pyth.herokuapp.com/?code=.AxM.PQ2&test_suite=1&test_suite_input=%5B%22Hello%22%2C+%22World%22%5D++++++++++++++++++++++%0A%5B%22Code%22%2C+%22Golf%22%2C+%22Is%22%2C+%22Cool%22%5D%0A%5B%221%22%2C+%222%22%2C+%223%22%2C+%224%22%2C+%225%22%5D%0A%5B%22This%22%2C+%22test%22%2C+%22case%22%2C+%22is%22%2C+%22true%22%5D++++++++++%0A%5B%22111%22%2C+%22010%22%2C+%22000%22%2C+%221101%22%2C+%221010%22%2C+%221000%22%2C+%220111%22%2C+%220010%22%2C+%221011%22%2C+%220110%22%2C+%2211001%22%2C+%2200110%22%2C+%2210011%22%2C+%2211000%22%2C+%2200111%22%2C+%2210010%22%5D%0A%5B%224%22%2C+%2242%22%5D+++++++++++++++++++++++++++++%0A%5B%221%22%2C+%222%22%2C+%223%22%2C+%2234%22%5D+++++++++++++++++++%0A%5B%22This%22%2C+%22test%22%2C+%22case%22%2C+%22is%22%2C+%22false%22%2C+%22t%22%5D%0A%5B%22He%22%2C+%22said%22%2C+%22Hello%22%5D%0A%5B%220%22%2C+%2200%22%2C+%2200001%22%5D%0A%5B%22Duplicate%22%2C+%22Duplicate%22%2C+%22Keys%22%2C+%22Keys%22%5D&debug=0)
Take all 2 element permutations of the input, map each to the index of one string in the other (0 for a prefix) and return whether all results are truthy (non-zero).
[Answer]
## Haskell, 37 bytes
```
f l=[x|x<-l,y<-l,zip x x==zip x y]==l
```
Each element `x` of `l` is repeated once for every element that it's a prefix of, which is exactly once for a prefix-free list, giving the original list. The prefix property is checked by zipping both lists with `x`, which cuts off elements beyond the length of `x`.
[Answer]
# Java, 128 127 126 125 124 121 bytes
### (Thanks @Kenny Lau, @Maltysen, @Patrick Roberts, @Joba)
```
Object a(String[]a){for(int i=0,j,l=a.length;i<l;i++)for(j=0;j<l;)if(i!=j&a[j++].startsWith(a[i]))return 1<0;return 1>0;}
```
### Ungolfed
```
Object a(String[] a) {
    for (int i = 0, j, l = a.length; i < l; i++) 
        for (j = 0; j < l;) 
            if (i != j & a[j++].startsWith(a[i])) return 1<0;
    return 1>0;
}
```
### Output
```
[Hello, World]
true
[Code, Golf, Is, Cool]
true
[1, 2, 3, 4, 5]
true
[This, test, case, is, true]
true
[111, 010, 000, 1101, 1010, 1000, 0111, 0010, 1011, 0110, 11001, 00110, 10011, 11000, 00111, 10010]
true
[4, 42]
false
[1, 2, 3, 34]
false
[This, test, case, is, false, t]
false
[He, said, Hello]
false
[0, 00, 00001]
false
[Duplicate, Duplicate, Keys, Keys]
false
```
[Answer]
## Python 2, 48 ~~51~~ bytes
```
lambda l:all(1/map(a.find,l).count(0)for a in l)
```
For each element `a` of `l`, the function `a.find` finds the index of the first occurrence of `a` in the input string, giving `-1` for an absence. So, `0` indicates a prefix. In a prefix-free list, mapping this function returns only a single `0` for `a` itself. The function checks that this is the case for every `a`.
---
**51 bytes:**
```
lambda l:[a for a in l for b in l if b<=a<b+'~']==l
```
Replace `~` with a character with ASCII code 128 or higher.
For each element `a` in `l`, a copy is included for each element that's a prefix of it. For a prefix-free list, the only such element is `a` itself, so this gives the original list.
[Answer]
## CJam, 14 bytes
```
q~$W%2ew::#0&!
```
[Test suite.](http://cjam.aditsu.net/#code=qN%2F%7B%3AQ%3B%0A%0AQ~%24W%252ew%3A%3A%230%26!%0A%0A%5DoNo%7D%2F&input=%5B%22Hello%22%20%22World%22%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%5B%22Code%22%20%22Golf%22%20%22Is%22%20%22Cool%22%5D%0A%5B%221%22%20%222%22%20%223%22%20%224%22%20%225%22%5D%0A%5B%22This%22%20%22test%22%20%22case%22%20%22is%22%20%22true%22%5D%20%20%20%20%20%20%20%20%20%20%0A%5B%22111%22%20%22010%22%20%22000%22%20%221101%22%20%221010%22%20%221000%22%20%220111%22%20%220010%22%20%221011%22%20%220110%22%20%2211001%22%20%2200110%22%20%2210011%22%20%2211000%22%20%2200111%22%20%2210010%22%5D%0A%5B%224%22%20%2242%22%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%5B%221%22%20%222%22%20%223%22%20%2234%22%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%5B%22This%22%20%22test%22%20%22case%22%20%22is%22%20%22false%22%20%22t%22%5D%0A%5B%22He%22%20%22said%22%20%22Hello%22%5D%0A%5B%220%22%20%2200%22%20%2200001%22%5D%0A%5B%22Duplicate%22%20%22Duplicate%22%20%22Keys%22%20%22Keys%22%5D)
### Explanation
```
q~   e# Read and evaluate input.
$    e# Sort strings. If a prefix exists it will end up directly in front 
     e# of a string which contains it.
W%   e# Reverse list.
2ew  e# Get all consecutive pairs of strings.
::#  e# For each pair, find the first occurrence of the second string in the first.
     e# If a prefix exists that will result in a 0, otherwise in something non-zero.
0&   e# Set intersection with 0, yielding [0] for falsy cases and [] for truthy ones.
!    e# Logical NOT.
```
[Answer]
# JavaScript ES6, ~~65~~ ~~43~~ 40 bytes
```
a=>!/(.*)\1/.test(''+a.sort().join``)
      ^            ^               ^ embedded NUL characters
```
My previous solution, which handled string arrays of all UTF-8 characters:
```
a=>!/[^\\]("([^"]*\\")*[^\\])",\1/.test(JSON.stringify(a.sort()))
```
I was able to avoid `JSON.stringify` since the challenge specifies printable ASCII characters only.
## Test
```
f=a=>!/(\0.*)\1/.test('\0'+a.sort().join`\0`) // since stackexchange removes embedded NUL characters
O.textContent += 'OK: '+
[["Hello", "World"]                      
,["Code", "Golf", "Is", "Cool"]
,["1", "2", "3", "4", "5"]
,["This", "test", "case", "is", "true"]          
,["111", "010", "000", "1101", "1010", "1000", "0111", "0010", "1011", 
 "0110", "11001", "00110", "10011", "11000", "00111", "10010"]
].map(a=>f(a)) 
O.textContent += '\nKO: '+
[["4", "42"]                             
,["1", "2", "3", "34"]                   
,["This", "test", "case", "is", "false", "t"]
,["He", "said", "Hello"]
,["0", "00", "00001"]
,["Duplicate", "Duplicate", "Keys", "Keys"]
].map(a=>f(a))
```
```
<pre id=O></pre>
```
[Answer]
# Haskell, 49 bytes
```
g x=[1|z<-map((and.).zipWith(==))x<*>x,z]==(1<$x)
```
This has a couple parts:
```
-- Are two lists (or strings) equal for their first min(length_of_1,length_of_2) elements, i.e. is one the prefix of the other?
(and.).zipWith(==)
-- Check whether one element is the prefix of the other, for all pairs of elements (including equal pairs)
map((and.).zipWith(==))x<*>x
-- This is a list of 1's of length (number of elements that are the prefix of the other)
[1|z<-map((and.).zipWith(==))x<*>x,z]
-- This is the input list, with all the elements replaced with 1's
(1<$x)
```
If the two lists are equal, then an element is only the prefix of itself, and it's valid.
[Answer]
## [Retina](https://github.com/mbuettner/retina), 19 bytes
Byte count assumes ISO 8859-1 encoding.
```
O`.+
Mm1`^(.+)¶\1
0
```
The input should be linefeed-separated. Output is `0` for falsy and `1` for truthy.
[Try it online!](http://retina.tryitonline.net/#code=JShgXHMKwrYKT2AuKwpNbTFgXiguKynCtlwxCjA&input=SGVsbG8gV29ybGQKQ29kZSBHb2xmIElzIENvb2wKMSAyIDMgNCA1ClRoaXMgdGVzdCBjYXNlIGlzIHRydWUKMTExIDAxMCAwMDAgMTEwMSAxMDEwIDEwMDAgMDExMSAwMDEwIDEwMTEgMDExMCAxMTAwMSAwMDExMCAxMDAxMSAxMTAwMCAwMDExMSAxMDAxMAo0IDQyCjEgMiAzIDM0ClRoaXMgdGVzdCBjYXNlIGlzIGZhbHNlIHQKSGUgc2FpZCBIZWxsbwowIDAwIDAwMDAxCkR1cGxpY2F0ZSBEdXBsaWNhdGUgS2V5cyBLZXlz) (Slightly modified to support multiple space-separated test cases instead.)
### Explanation
```
O`.+
```
Sort the lines in the input. If a prefix exists it will end up directly in front of a string which contains it.
```
Mm1`^(.+)¶\1
```
Try to match (`M`) a complete line which is also found at the beginning of the next line. The `m` activates multiline mode such that `^` matches line beginnings and the `1` ensures that we only count at most one match such that the output is `0` or `1`.
```
0
```
To swap `0` and `1` in the result, we count the number of `0`s.
[Answer]
# Java, 97 bytes
```
Object a(String[]a){for(String t:a)for(String e:a)if(t!=e&t.startsWith(e))return 1<0;return 1>0;}
```
Uses most of the tricks found in [@Marv's answer](https://codegolf.stackexchange.com/a/79097/32531), but also makes use of the foreach loop and string reference equality.
Unminified:
```
Object a(String[]a){
    for (String t : a)
        for (String e : a)
            if (t != e & t.startsWith(e))
                return 1<0;
    return 1>0;
}
```
Note that, as I said, this uses string reference equality. That does mean that the code can behave oddly due to [String interning](https://stackoverflow.com/a/10579062/3991344). The code does work when using arguments passed from the command line, and also when using something read from the command line. If you want to hardcode the values to test, though, you'd need to manually call the String constructor to force interning to not occur:
```
System.out.println(a(new String[] {new String("Hello"), new String("World")}));
System.out.println(a(new String[] {new String("Code"), new String("Golf"), new String("Is"), new String("Cool")}));
System.out.println(a(new String[] {new String("1"), new String("2"), new String("3"), new String("4"), new String("5")}));
System.out.println(a(new String[] {new String("This"), new String("test"), new String("case"), new String("is"), new String("true")}));
System.out.println(a(new String[] {new String("111"), new String("010"), new String("000"), new String("1101"), new String("1010"), new String("1000"), new String("0111"), new String("0010"), new String("1011"), new String("0110"), new String("11001"), new String("00110"), new String("10011"), new String("11000"), new String("00111"), new String("10010")}));
System.out.println(a(new String[] {new String("4"), new String("42")}));
System.out.println(a(new String[] {new String("1"), new String("2"), new String("3"), new String("34")}));
System.out.println(a(new String[] {new String("This"), new String("test"), new String("case"), new String("is"), new String("false"), new String("t")}));
System.out.println(a(new String[] {new String("He"), new String("said"), new String("Hello")}));
System.out.println(a(new String[] {new String("0"), new String("00"), new String("00001")}));
System.out.println(a(new String[] {new String("Duplicate"), new String("Duplicate"), new String("Keys"), new String("Keys")}));
```
[Answer]
# PostgreSQL, 186, 173 bytes
```
WITH y AS(SELECT * FROM t,LATERAL unnest(c)WITH ORDINALITY s(z,r))
SELECT y.c,EVERY(u.z IS NULL)
FROM y LEFT JOIN y u ON y.i=u.i AND y.r<>u.r AND y.z LIKE u.z||'%' GROUP BY y.c
```
Output:
[![enter image description here](https://i.stack.imgur.com/Jaevb.png)](https://i.stack.imgur.com/Jaevb.png)
No live demo this time. <http://sqlfiddle.com> supports only 9.3 and to run this demo 9.4 is required.
How it works:
1. Split string array with number and name it `y`
2. Get all y
3. `LEFT OUTER JOIN` to the same derived table based on the same `i`(id), but with different `oridinal` that start with prefix `y.z LIKE u.z||'%'`
4. Group result based on `c` (initial array) and use `EVERY` grouping function. If every row from second table `IS NULL` it means there is no prefixes.
---
Input if someone is interested:
```
CREATE TABLE t(i SERIAL,c text[]);
INSERT INTO t(c)
SELECT '{"Hello", "World"}'::text[]
UNION ALL SELECT  '{"Code", "Golf", "Is", "Cool"}'
UNION ALL SELECT  '{"1", "2", "3", "4", "5"}'
UNION ALL SELECT  '{"This", "test", "case", "is", "true"}'         
UNION ALL SELECT  '{"111", "010", "000", "1101", "1010", "1000", "0111", "0010", "1011","0110", "11001", "00110", "10011", "11000", "00111", "10010"}'
UNION ALL SELECT  '{"4", "42"}'
UNION ALL SELECT  '{"1", "2", "3", "34"}'                   
UNION ALL SELECT  '{"This", "test", "case", "is", "false", "t"}'
UNION ALL SELECT  '{"He", "said", "Hello"}'
UNION ALL SELECT  '{"0", "00", "00001"}'
UNION ALL SELECT  '{"Duplicate", "Duplicate", "Keys", "Keys"}';
```
**EDIT:**
`SQL Server 2016+` implementation:
```
WITH y AS (SELECT *,z=value,r=ROW_NUMBER()OVER(ORDER BY 1/0) FROM #t CROSS APPLY STRING_SPLIT(c,','))
SELECT y.c, IIF(COUNT(u.z)>0,'F','T')
FROM y LEFT JOIN y u ON y.i=u.i AND y.r<>u.r AND y.z LIKE u.z+'%' 
GROUP BY y.c;
```
`**[`LiveDemo`](https://data.stackexchange.com/stackoverflow/query/483366)**`
Note: It is comma separated list, not real array. But the main idea is the same as in `PostgreSQL`.
---
**EDIT 2:**
Actually `WITH ORDINALITY` could be replaced:
```
WITH y AS(SELECT *,ROW_NUMBER()OVER()r FROM t,LATERAL unnest(c)z)
SELECT y.c,EVERY(u.z IS NULL)
FROM y LEFT JOIN y u ON y.i=u.i AND y.r<>u.r AND y.z LIKE u.z||'%' GROUP BY y.c
```
`**[`SqlFiddleDemo`](http://sqlfiddle.com/#!15/7015d8/4/0)**`
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 8 bytes
```
¬(⊇pa₀ᵈ)
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSuVv2obcOjpuZHHcuVSopKU5VqQKy0xJziVKXaciU9BaWHuzprH26d8P/QGo1HXe0FiY@aGh5u7dD8/z86WskjNScnX0lHKTy/KCdFKVYnWskEyDMxAjOd81NSgTz3/Jw0IOVZDCSc8/NzwHKGQI4REBuDsAmGEMgUU7BoSEYmSGNJanEJkEpOLAYZCRaCuBEoRUAd2FcgJR4goeLEzBQgBXE4SNQAyDOAEAYGhkqxsQA "Brachylog – Try It Online")
Outputs through predicate success/failure. Takes more than 60 seconds on the last truthy test case `["111","010","000","1101","1010","1000","0111","0010","1011","0110","11001","00110","10011","11000","00111","10010"]` [but passes it quickly with an added byte](https://tio.run/##SypKTM6ozMlPN/r//9AajUdd7Ue6ChIfNTU83Nqh@f9/tJKhoaGSjpKBoQGINACRhoYGICFDiJghRNAAqg4mCNVlCNVgAJWEaQFLG8L0QjUbgnXHAgA) which eliminates a large number of possibilities earlier than the program does otherwise (`Ċ` before checking permutations rather than `ᵈ` after checking permutations, to limit the length of the sublist to two).
```
¬(     )    It cannot be shown that
   p        a permutation of
  ⊇         a sublist of the input
      ᵈ     is a pair of values [A,B] such that
    a₀      A is a prefix of B.
```
Less trivial 9-byte variants than [`¬(⊇Ċpa₀ᵈ)`](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSuVv2obcOjpuZHHcuVSopKU5VqQKy0xJziVKXaciU9BaWHuzprH26d8P/QGo1HXe1HugoSHzU1PNzaofn/f3S0kkdqTk6@ko5SeH5RTopSrE60kgmQZ2IEZjrnp6QCee75OWlAyrMYSDjn5@eA5QyBHCMgNgZhEwwhkCmmYNGQjEyQxpLU4hIglZxYDDISLARxJVCKgDqwv0BKPEBCxYmZKUAK4nCwtYYgiw0MDUCkAYg0NDQACRlCxAwhggZQdTBBqC5DqAYDqCRMC1jaEKYXqtkQrBtkKUQUYiNQa2wsAA) which run in reasonable time are [`¬(⊇o₁a₀ᵈ)`](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSuVv2obcOjpuZHHcuVSopKU5VqQKy0xJziVKXaciU9BaWHuzprH26d8P/QGo1HXe35j5oaEx81NTzc2qH5/390tJJHak5OvpKOUnh@UU6KUqxOtJIJkGdiBGY656ekAnnu@TlpQMqzGEg45@fngOUMgRwjIDYGYRMMIZAppmDRkIxMkMaS1OISIJWcWAwyEiwEcSZQioA6sMdASjxAQsWJmSlACuJwsLWGIIsNDA1ApAGINDQ0AAkZQsQMIYIGUHUwQaguQ6gGA6gkTAtY2hCmF6rZEKwbZClEFGIjUGtsLAA), [`¬(⊇o↔a₀ᵈ)`](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSuVv2obcOjpuZHHcuVSopKU5VqQKy0xJziVKXaciU9BaWHuzprH26d8P/QGo1HXe35j9qmJD5qani4tUPz///oaCWP1JycfCUdpfD8opwUpVidaCUTIM/ECMx0zk9JBfLc83PSgJRnMZBwzs/PAcsZAjlGQGwMwiYYQiBTTMGiIRmZII0lqcUlQCo5sRhkJFgI4kygFAF1YI@BlHiAhIoTM1OAFMThYGsNQRYbGBqASAMQaWhoABIyhIgZQgQNoOpgglBdhlANBlBJmBawtCFML1SzIVg3yFKIKMRGoNbYWAA), and [`¬(⊇oa₀ᵈ¹)`](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSuVv2obcOjpuZHHcuVSopKU5VqQKy0xJziVKXaciU9BaWHuzprH26d8P/QGo1HXe35iY@aGh5u7Ti0U/P//@hoJY/UnJx8JR2l8PyinBSlWJ1oJRMgz8QIzHTOT0kF8tzzc9KAlGcxkHDOz88ByxkCOUZAbAzCJhhCIFNMwaIhGZkgjSWpxSVAKjmxGGQkWAjiSqAUAXVgf4GUeICEihMzU4AUxOFgaw1BFhsYGoBIAxBpaGgAEjKEiBlCBA2g6mCCUF2GUA0GUEmYFrC0IUwvVLMhWDfIUogoxEag1thYAA).
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 24 bytes
```
{.all.starts-with(.one)}
```
[Try it online!](https://tio.run/##hVHBSgMxED27XxFyKC1oSNrVi4hIFSt6FD2UPYRuQhfGpiQpspR@@9qZTVaUijnM23l583ZmsjUerrqPlo0su2HdXmgAEaL2MVx8NnE9Fm5jJofuurDOszE0GxMmbF@cBd2yW/HwdvciRrY4dEu@MACOnzP@7jzUvGInT7Hkc1cb1D06sIhPAePcOeDV8VphNsUww1BiuKSb13VD0mhCRFzpQEaJ9TvTGyiykEoSSAKlJLEq0SrxMqsHPlerXCezYKjsJWrwyCaKXLAH6rqc/rWF72X8mnZWniz5d3iroU8j/X5B30E3NWL/MsindtNejoMheb/bQrPSkWp@JM@mDQNWXw "Perl 6 – Try It Online")
Wow, surprisingly short while using a long built-in.
### Explanation
```
{                      }  # Anonymous code block taking a list
 .all                     # Do all of the strings
     .starts-with(    )   # Start with
                  .one    # Only one other string (i.e. itself)
```
[Answer]
# Racket, 70 bytes
```
(λ(l)(andmap(λ(e)(not(ormap(curryr string-prefix? e)(remv e l))))l))
```
[Answer]
# JavaScript (ES6), 52 ~~54~~
**Edit** 2 bytes saved thx @Neil
```
a=>!a.some((w,i)=>a.some((v,j)=>i-j&&!w.indexOf(v)))
```
**Test**
```
f=a=>!a.some((w,i)=>a.some((v,j)=>i-j&&!w.indexOf(v)))
O.textContent += 'OK: '+
[["Hello", "World"]                      
,["Code", "Golf", "Is", "Cool"]
,["1", "2", "3", "4", "5"]
,["This", "test", "case", "is", "true"]          
,["111", "010", "000", "1101", "1010", "1000", "0111", "0010", "1011", 
 "0110", "11001", "00110", "10011", "11000", "00111", "10010"]
].map(a=>f(a)) 
O.textContent += '\nKO: '+
[["4", "42"]                             
,["1", "2", "3", "34"]                   
,["This", "test", "case", "is", "false", "t"]
,["He", "said", "Hello"]
,["0", "00", "00001"]
,["Duplicate", "Duplicate", "Keys", "Keys"]
].map(a=>f(a))
```
```
<pre id=O></pre>
```
[Answer]
# Mathematica ~~75 69~~ 68 bytes
Loquacious as usual. But Martin B was able to reduce the code by 7 bytes.
## Method 1: Storing output in an `Array`
(68 bytes)
```
f@a_:=!Or@@(Join@@Array[a~Drop~{#}~StringStartsQ~a[[#]]&,Length@a])
```
---
```
f@{"111", "010", "000", "1101", "1010", "1000", "0111", "0010", "1011", "0110", "11001", "00110", "10011", "11000", "00111", "10010"}
```
> 
> True
> 
> 
> 
---
```
f@{"He", "said", "Hello"}
```
> 
> False
> 
> 
> 
---
[Answer]
## Mathematica, 41 bytes
```
!Or@@StringStartsQ@@@Reverse@Sort@#~Subsets~{2}&
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 13 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
-2 bytes:
```
≢=∘≢∘⍸∘.(⊃⍷)⍨
```
[Try it online!](https://tio.run/##hVGxTsMwEN37FWxOBpDdhJEpSCRiQKKVmK3GgUiWXNXp0BmpAiRXMCAxMzEgMcLMp/hHgu9sh1YqIsN7und3z3cXPpeH9YpLdd339v71xN69OAI0Xw6PEvtwa81nas1b39j1ozUbu3muLpz8/ZHZ9ZOLJpeFw2lZTfomIaWQUpE0IVdqIWuSHuz9Rq6yULWAwjMlG@BKAxZKSZJCnkE4BsgAcoBjn5retFjcCd0Bz7hGq6AulmL7YTRjaEcZRaJIjFFUWZBZ0GmsHvTYzWIfjQVDpy9hg0c0Yd5lZM07DIJr5OO/DrM98u7@Wb635/9zNFz6sPPHKzHQvK2Bw/@CRJg7HAg2BPV0OZftjHfYtROci5X@5R8 "APL (Dyalog Unicode) – Try It Online")
Explanation:
```
≢=∘≢∘⍸∘.(⊃⍷)⍨  ⍝ Monadic function train
         ⍷     ⍝ "Find": Convert the right argument into a boolean vector,
               ⍝ where ones correspond to instances of the left argument
        ⊃     ⍝ Take the first item of the above vector (i.e., only prefixes)
     ∘.(  )⍨  ⍝ Commutative outer product: take the above function and apply
              ⍝ it for each possible pair of elements in the input
              ⍝ If the input is a prefix code, the above should have a number of ones
              ⍝ equal to the length of the input (i.e., each item is a prefix of only itself)
              ⍝ To test this...
     ⍸        ⍝ Find the location of all ones in the above
   ≢∘         ⍝ Take the length of the above
≢=∘           ⍝ Compare to the length of the input
```
[Answer]
# [J](http://jsoftware.com/), 17 bytes
```
#=1#.1#.{.@E.&>/~
```
[Try it online!](https://tio.run/##jVFbS8MwGH3vrzg4WBC27Pu2@rJZEedlovggAx@ltCmrBCJL9iCCf73mgqAYxJKEnJwLyenLcCRFh2oJgQkISz@nEuvH@@thVPFI@vEuz6/k@Gz2MRwXxcOFhNsfVFGoZmfAqNDhdCWf2SdslNYGT2avW5Hj16ZVuDG6w631wOisijHHAiVOsux211s4ZR2a2ioE4K@TD2IGMYGI/J4YHBAHSJFLkFkgZ/dE9FFUJqd3cQqICeGERGqlq7X9qoV@BJUo5wJ/fTlXqmFRin/qfxcTbwQncuqNgq37Nv2yrCK8MVRHnKUvD6@6b2qnvu3u1JuNi69k@AQ "J – Try It Online")
*Note: I actually wrote this before looking at the APL answer, to approach it without bias. Turns out the approaches are almost identical, which is interesting. I guess this is the natural "array thinknig" solution*
Take boxed input because the strings are of unequal length.
Create a self-function table `/~` of each element paired with each element and see if there is a match at the start `{.@E.`. This will produce a matrix of 1-0 results.
Sum it twice `1#.1#.` to get a single number representing "all ones in the matrix", and see if that number is the same as the length of the input `#=`. If it is, the only prefix matches are self matches, ie, we have a prefix code.
## sorting solution, 18 bytes
```
0=1#.2{.@E.&>/\/:~
```
Attempt at different approach. This solution sorts and looks at adjacent pairs.
[Try it online!](https://tio.run/##jVHLSsQwFN33Kw4KBkEz93bqploRx8fIiAsR3AhS2pSpBCKTzEIEf73mgaAYxEBCTs6D5ORl2pFiQFND4ACE2s9DicX97dVEDe/K8l2eXcq909nTrP6Y9ovi7lzCbbaqKFS3NmA0GHByLJ/ZRyyV1gaPZqN7keMXple4NnrAjfXA6KyKUWKOCkdZ9mE9WjhlHbrWKgTgr5MPYgYxgYj8nhgcEAdIkUuQWSBn90T0UVQmp3dxCogJ4YREamVotf2qhX4EVahKgb9GzpVqmFfin/rfxcQbwYmceqlg27FPX5ZVhDeG6oiz9MX2VY9d69S33Uq92bj4SqZP "J – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 48 bytes
```
function(s)sum(outer(s,s,startsWith))==length(s)
```
[Try it online!](https://tio.run/##jVE9a8MwEN37K4InCTLoEnf0lEITuhYyC1uqBapVpNOQX@9apw9ImyE23OOe3nvWnf2qh1XHZUTjFhZ4iN/MRVSehf32ovQYrgZnzofBquUL5020ajay7qysdd1@112dt1PH@e7f80LCk5tU0r07qxNeQqon5@xmyhJIzCGVYyp9Kq/t9HM2ZEEVMOEoAwUW1keVv16ygNIECAJBACCIhUJD4UVVN766ofpEFTRnlkDLqCFAKfXWNER/eLiY@wX9mf7YPzm5lja32Axn6oM0U8L8i@pZuWzZyjZWPXiLP9aMEsl713yoW2jI@foL "R – Try It Online")
Explanation: `outer(s,s,startsWith)` outputs a matrix of logicals checking whether `s[i]` is a prefix of `s[j]`. If `s` is a prefix code, then there are exactly `length(s)` TRUE elements in the result, corresponding to the diagonal elements (`s[i]` is a prefix of itself).
[Answer]
# Pyth - ~~13~~ 12 bytes
```
!ssmm}d._k-Q
```
[Try it online here](http://pyth.herokuapp.com/?code=%21ssmm%7Dd._k-Q&test_suite=1&test_suite_input=%5B%22Hello%22%2C+%22World%22%5D++++++++++++++++++++++%0A%5B%22Code%22%2C+%22Golf%22%2C+%22Is%22%2C+%22Cool%22%5D%0A%5B%221%22%2C+%222%22%2C+%223%22%2C+%224%22%2C+%225%22%5D%0A%5B%22This%22%2C+%22test%22%2C+%22case%22%2C+%22is%22%2C+%22true%22%5D++++++++++%0A%5B%22111%22%2C+%22010%22%2C+%22000%22%2C+%221101%22%2C+%221010%22%2C+%221000%22%2C+%220111%22%2C+%220010%22%2C+%221011%22%2C+%220110%22%2C+%2211001%22%2C+%2200110%22%2C+%2210011%22%2C+%2211000%22%2C+%2200111%22%2C+%2210010%22%5D%0A%5B%224%22%2C+%2242%22%5D+++++++++++++++++++++++++++++%0A%5B%221%22%2C+%222%22%2C+%223%22%2C+%2234%22%5D+++++++++++++++++++%0A%5B%22This%22%2C+%22test%22%2C+%22case%22%2C+%22is%22%2C+%22false%22%2C+%22t%22%5D%0A%5B%22He%22%2C+%22said%22%2C+%22Hello%22%5D%0A%5B%220%22%2C+%2200%22%2C+%2200001%22%5D&debug=0).
[Answer]
# Ruby, 48 bytes
Uses arguments as input and stdout as output.
```
p !$*.map{a,*b=$*.rotate!
a.start_with? *b}.any?
```
[Answer]
# Python, ~~58~~ 55 bytes
```
lambda l:sum(0==a.find(b)for a in l for b in l)==len(l)
```
[Answer]
# Scala, 71 bytes
```
(s:Seq[String])=>(for{x<-s;y<-s}yield x!=y&&x.startsWith(y)).forall(!_)
```
[Answer]
## Racket 130 bytes
```
(define g #t)(for((n(length l)))(for((i(length l))#:unless(= i n))(when(string-prefix?(list-ref l i)(list-ref l n))(set! g #f))))g
```
Ungolfed:
```
(define(f l)
  (define g #t)
  (for ((n (length l)))
    (for ((i (length l)) #:unless (= i n))
      (when (string-prefix? (list-ref l i) (list-ref l n))
        (set! g #f))))g)
```
Testing:
```
(f [list "Hello" "World"])             
(f [list "Code" "Golf" "Is" "Cool"])
(f [list "1" "2" "3" "4" "5"])
(f [list "This" "test" "case" "is" "true"])          
(f [list "111" "010" "000" "1101" "1010" "1000" "0111" "0010" "1011" 
         "0110" "11001" "00110" "10011" "11000" "00111" "10010"])
(f [list "4" "42"])                             
(f [list "1" "2" "3" "34"])                   
(f [list "This" "test" "case" "is" "false" "t"])
(f [list "He" "said" "Hello"])
(f [list "0" "00" "00001"])
(f [list "Duplicate" "Duplicate" "Keys" "Keys"])
```
Output: 
```
#t
#t
#t
#t
#t
#f
#f
#f
#f
#f
#f
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 93 bytes
```
p(r,e,f,i,x)char**r;{for(f=i=0;i<e;++i)for(x=0;x<e;++x)f|=x!=i&&strstr(r[i],r[x])==r[i];r=f;}
```
[Try it online!](https://tio.run/##dY1BbsMgEEX3OQXJIgKbVDNrygF6BscLi0KK1GJr7FZISc5OGbxtBxb/Px7gLjfnSlkkaa@Djjor9zFR15G5h5lksNGCia/e9H1UTHLtufWswsPmo43n87pR3ZKGOGoa8qis5WzIBvMsMW3ia4pJcpjo5rTgT0RX888wKnE/iDoxCHlcJMMeNXsX1MBLqSbwLFQfCfL0ttboQ8zCze/@5ZpOyjTJf67@LzvN2z83yG/flASYw7MURCyAUACgZsCC3JArtLO9NgubAg3uUsW4u01mAr8 "C (gcc) – Try It Online")
Simple double for loop using `strstr(a,b)==a` to check for prefices. Mainly added since there doesn't seem to be a C answer yet.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 13 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
2.ÆDí«ε`Å?}O_
```
Too long.. Initially I had a 9-byte solution, but it failed for the duplicated key test case.
[Try it online](https://tio.run/##yy9OTMpM/f/fSO9wm8vhtYdWn9uacLjVvtY//v//aKWQjMxiJR0FpZLU4hIQnZxYnAqiIaJpiTkQbolSLAA) or [verify all test cases](https://tio.run/##hZCxCsIwEEB/pWQukqt17qCg4uAiOJSi0UYsBCKmCh0c9QP8DXH0B@zuR/gj9S5JQXBwuLvk3T1yrTZiVcjmWCUseF@uAUuqJurUl0F9f95ej2V9Tk7TRRM2acpGUinNQjbXe5WzLExZX@cSwVCrDZaxwdTXWtke4CXC6GLEGD1LZ9uCpkppSixrYch3aH@QTgRSOXDKnDIAJwSOgYPcz7XQW@AF7putYtvQul4Ga2dhEKR2xzj6Wb0b/9l7I5S9lHZuREcjihyL@19E3Zvue3AxQoPDThVrUdL893kiK9OWLPsA).
**Explanation:**
```
2.Æ             # Get all combinations of two elements from the (implicit) input-list
   Dí           # Duplicate and reverse each pair
     «          # Merge the lists of pairs together
      ε         # Map each pair to:
       `        #  Push both strings to the stack
        Å?      #  And check if the first starts with the second
          }O    # After the map: sum to count all truthy values
            _   # And convert it to truthy if it's 0 or falsey if it's any other integer
                # (which is output implicitly as result)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 8 bytes
```
á2 ËrbÃe
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=2.0a0&code=4TIgy3Jiw2U&input=WyJDb2RlIiwiR29sZiIsIklzIiwiQ29vbCJd)
```
á2 ËrbÃe     :Implicit input of array
á2           :Permutations of length 2
   Ë         :Map each pair
    r        :  Reduce by
     b       :  Get the index of the second in the first - 0 (falsey) if it's a prefix
      Ã      :End map
       e     :All truthy (-1 or >0)
```
[Answer]
## [C# (Visual C# Interactive Compiler)](https://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 70 bytes
```
l=>!l.Any(x=>l.Where((y,i)=>l.IndexOf(x)!=i).Any(z=>z.StartsWith(x)));
```
[Try it online!](https://tio.run/##pVJNT4NAEL37KyinJalkt8VTC4mp0TY28aAJZ4RFJtnsGnYbocbfjuzwET25Kod5mcd7byYDub7MNXS3J5lvj6DNVpsa5EuyfFZKJGXciThZiPBatqSJExGmFa85Ie0SAtseZMGbh5I0wSKGAGXnODmHjyarjU7BVP2rINh0G298LtIaDD@C5KQkkr95X6e@@3suhPKXnp@qWhT@R@/9wbFTBbeGOyVKiwdt665f38XNrHhly9qWyJYrF@NTBTjIcG0s5pnGNZD9xXyGG1BGESgCYxRZNtJs5OmknvnJzSYfnQSzc5CwOWMKYZjisCLeJFr94Zrr6N@X9MtMDK1xydqjVGdQWBx@JgfbeJnxE/Q3dPDcnF4F5JnBid@ae97qGW1S9wk)
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 6 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
å·↑↑¶Ω
```
[Run and debug it](https://staxlang.xyz/#p=86fa181814ea&i=[%22Hello%22,+%22World%22]++++++++++++++++++++++%0A[%22Code%22,+%22Golf%22,+%22Is%22,+%22Cool%22]%0A[%221%22,+%222%22,+%223%22,+%224%22,+%225%22]%0A[%22This%22,+%22test%22,+%22case%22,+%22is%22,+%22true%22]++++++++++%0A[%22111%22,+%22010%22,+%22000%22,+%221101%22,+%221010%22,+%221000%22,+%220111%22,+%220010%22,+%221011%22,+%220110%22,+%2211001%22,+%2200110%22,+%2210011%22,+%2211000%22,+%2200111%22,+%2210010%22]%0A[%224%22,+%2242%22]+++++++++++++++++++++++++++++%0A[%221%22,+%222%22,+%223%22,+%2234%22]+++++++++++++++++++%0A[%22This%22,+%22test%22,+%22case%22,+%22is%22,+%22false%22,+%22t%22]%0A[%22He%22,+%22said%22,+%22Hello%22]%0A[%220%22,+%2200%22,+%2200001%22]%0A[%22Duplicate%22,+%22Duplicate%22,+%22Keys%22,+%22Keys%22]%0A&a=1&m=2)
This produces non-zero for truthy.
The general idea is to consider every pair of strings in the input. If the substring index of one in the other is ever zero, then it's not a valid prefix code. In stax, index of a non-existing substring yields `-1`. This way, all the pair-wise substring indices can be multiplied together.
This is the same algorithm as isaacg's pyth solution, but I developed it independently.
]