Skip to main content
added 265 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

Husk, 8 bytes

ḟȯ=L¹LUT

Try it online!

Different approach to the previous Husk answer. Gets the longest prefix with all-unique characters from each index position, and then selects the first that is the same length as the number of input strings.

ḟ           # first element that satisfies
 ȯ=L¹L      # length (of string) equals length of input (array), of
      U     # longest prefixes of all unique characters of
       T    # transpose of input

Husk, 8 bytes

ḟȯ=L¹LUT

Try it online!

ḟ           # first element that satisfies
 ȯ=L¹L      # length (of string) equals length of input (array), of
      U     # longest prefixes of all unique characters of
       T    # transpose of input

Husk, 8 bytes

ḟȯ=L¹LUT

Try it online!

Different approach to the previous Husk answer. Gets the longest prefix with all-unique characters from each index position, and then selects the first that is the same length as the number of input strings.

ḟ           # first element that satisfies
 ȯ=L¹L      # length (of string) equals length of input (array), of
      U     # longest prefixes of all unique characters of
       T    # transpose of input
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

Husk, 8 bytes

ḟȯ=L¹LUT

Try it online!

ḟ           # first element that satisfies
 ȯ=L¹L      # length (of string) equals length of input (array), of
      U     # longest prefixes of all unique characters of
       T    # transpose of input