Skip to main content
deleted 141 characters in body
Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Perl 6, 3838 30 bytes

{+(1...all ~*∉$_,*.comb==x.max.comb...*∉$_).tail}

Try it online!Try it online!

Anonymous codeblock that takes input as a list of two strings, and returns the first number that is the same length as the stringfrom 1111... with a non-empty amount of 1s that isn't in the maximum length, and is not equal to either stringinput.

Explanation:

{                                  }   # Anonymous codeblock
code block
  1. x.max.       comb                 # StartingString frommultiply 1, increment until
       all      ,           by the size of the #non-empty Both:string
           ~*∉$_     ...              # The numberCreate isa notsequence inincreasing theby input1
                 *.comb  *∉$_          # And the length ofUntil the number
                       ==.max.comb # Isis equalnot toin the maximum lengthinput
 +(                               ).tail  # Return the# lengthAnd oftake the sequencelast number

Perl 6, 38 bytes

{+(1...all ~*∉$_,*.comb==.max.comb)}

Try it online!

Anonymous codeblock that takes input as a list of two strings, and returns the first number that is the same length as the string with the maximum length, and is not equal to either string.

Explanation:

{                                  }  # Anonymous codeblock
   1...                        # Starting from 1, increment until
       all      ,                # Both:
           ~*∉$_                   # The number is not in the input
                 *.comb            # And the length of the number
                       ==.max.comb # Is equal to the maximum length
 +(                               )  # Return the length of the sequence

Perl 6, 38 30 bytes

{(1 x.max.comb...*∉$_).tail}

Try it online!

Anonymous codeblock that takes input as a list of two strings, and returns the first number from 1111... with a non-empty amount of 1s that isn't in the input.

Explanation:

{                          }   # Anonymous code block
  1 x.max.comb                 # String multiply 1 by the size of the non-empty string
              ...              # Create a sequence increasing by 1
                 *∉$_          # Until the number is not in the input
 (                   ).tail    # And take the last number
added explanation
Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Perl 6, 38 bytes

{+(1...all ~*∉$_,*.comb==.max.comb)}

Try it online!

Anonymous codeblock that takes input as a list of two elementsstrings, and returns the first number that is the same length as the elementstring with the maximum length, and is not equal to either string.

Explanation:

{                                  }  # Anonymous codeblock
   1...                        # Starting from 1, increment until
       all      ,                # Both:
           ~*∉$_                   # The number is not in the input
                 *.comb            # And the length of the number
                       ==.max.comb # Is equal to the maximum length
 +(                               )  # Return the length of the sequence

Perl 6, 38 bytes

{+(1...all ~*∉$_,*.comb==.max.comb)}

Try it online!

Anonymous codeblock that takes input as a list of two elements, and returns the first number that is the same length as the element with the maximum length, and is not equal to either string.

Perl 6, 38 bytes

{+(1...all ~*∉$_,*.comb==.max.comb)}

Try it online!

Anonymous codeblock that takes input as a list of two strings, and returns the first number that is the same length as the string with the maximum length, and is not equal to either string.

Explanation:

{                                  }  # Anonymous codeblock
   1...                        # Starting from 1, increment until
       all      ,                # Both:
           ~*∉$_                   # The number is not in the input
                 *.comb            # And the length of the number
                       ==.max.comb # Is equal to the maximum length
 +(                               )  # Return the length of the sequence
Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Perl 6, 38 bytes

{+(1...all ~*∉$_,*.comb==.max.comb)}

Try it online!

Anonymous codeblock that takes input as a list of two elements, and returns the first number that is the same length as the element with the maximum length, and is not equal to either string.