Tweeted twitter.com/StackCodeGolf/status/1034274539679698946
3 deleted 57 characters in body
source | link

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8
["AacaAc", "Aab"] => 2

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8
["AacaAc", "Aab"] => 2

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8
["AacaAc", "Aab"] => 2

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code.

2 added 28 characters in body
source | link

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8
["AacaAc", "Aab"] => 2

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8
["AacaAc", "Aab"] => 2

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.

1
source | link

Maximum Hamming distance among a list of padded strings

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined.

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below.

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:

  • wrap the string from the beginning as many times as needed to match the required length
  • change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
  • leave things outside a-zA-Z unchanged when wrapping

For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^

with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character.

The output is an integer.

Rules

This is . Standard rules apply.

Test cases

[ "a", "b" ] => 1
[ "a", "b", "c" ] => 1
[ "a", "a", "c" ] => 1
[ "abc", "abcd" ] => 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] => 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] => 8

Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code. The code produces a matrix of all the pairwise distances.