Skip to main content
deleted 2 characters in body
Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 999

CJam, 14 bytes

q~$W%2ew::#0&! 

Test suite.

Explanation

q~ e# Read and evaluate input. $ e# Sort strings. If a prefix exists it will end up directly in front e# of thea 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. 

CJam, 14 bytes

q~$W%2ew::#0&! 

Test suite.

Explanation

q~ e# Read and evaluate input. $ e# Sort strings. If a prefix exists it will end up directly in front e# of the 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. 

CJam, 14 bytes

q~$W%2ew::#0&! 

Test suite.

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. 
Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 999

CJam, 14 bytes

q~$W%2ew::#0&! 

Test suite.

Explanation

q~ e# Read and evaluate input. $ e# Sort strings. If a prefix exists it will end up directly in front e# of the 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.