CONTRACTS: Hamming Code parity sentence clarification, "Find All Valid Math Expressions" missing line breaks added, example formatting made consistent (#1550)

This commit is contained in:
gmcew 2024-08-06 23:02:54 +01:00 committed by GitHub
parent 1a8dcad02b
commit 2d1747b3e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1071,8 +1071,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"provide all of the possible results. The answer should be provided", "provide all of the possible results. The answer should be provided",
"as an array of strings. If it is impossible to validate the string", "as an array of strings. If it is impossible to validate the string",
"the result should be an array with only an empty string.\n\n", "the result should be an array with only an empty string.\n\n",
"IMPORTANT: The string may contain letters, not just parentheses.", "IMPORTANT: The string may contain letters, not just parentheses.\n\n",
`Examples:\n`, `Examples:\n\n`,
`"()())()" -> ["()()()", "(())()"]\n`, `"()())()" -> ["()()()", "(())()"]\n`,
`"(a)())()" -> ["(a)()()", "(a())()"]\n`, `"(a)())()" -> ["(a)()()", "(a())()"]\n`,
`")(" -> [""]`, `")(" -> [""]`,
@ -1186,9 +1186,9 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"The data provided by this problem is an array with two elements. The first element", "The data provided by this problem is an array with two elements. The first element",
"is the string of digits, while the second element is the target number:\n\n", "is the string of digits, while the second element is the target number:\n\n",
`["${digits}", ${target}]\n\n`, `["${digits}", ${target}]\n\n`,
"NOTE: The order of evaluation expects script operator precedence", "NOTE: The order of evaluation expects script operator precedence.\n",
"NOTE: Numbers in the expression cannot have leading 0's. In other words,", "NOTE: Numbers in the expression cannot have leading 0's. In other words,",
`"1+01" is not a valid expression`, `"1+01" is not a valid expression.\n\n`,
"Examples:\n\n", "Examples:\n\n",
`Input: digits = "123", target = 6\n`, `Input: digits = "123", target = 6\n`,
`Output: ["1+2+3", "1*2*3"]\n\n`, `Output: ["1+2+3", "1*2*3"]\n\n`,
@ -1295,14 +1295,14 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
`${n} \n\n`, `${n} \n\n`,
"Convert it to a binary representation and encode it as an 'extended Hamming code'.\n ", "Convert it to a binary representation and encode it as an 'extended Hamming code'.\n ",
"The number should be converted to a string of '0' and '1' with no leading zeroes.\n", "The number should be converted to a string of '0' and '1' with no leading zeroes.\n",
"Parity bits are inserted at positions 0 and 2^N.\n", "A parity bit is inserted at position 0 and at every position N where N is a power of 2.\n",
"Parity bits are used to make the total number of '1' bits in a given set of data even.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n",
"The parity bit at position 0 considers all bits including parity bits.\n", "The parity bit at position 0 considers all bits including parity bits.\n",
"Each parity bit at position 2^N alternately considers N bits then ignores N bits, starting at position 2^N.\n", "Each parity bit at position 2^N alternately considers N bits then ignores N bits, starting at position 2^N.\n",
"The endianness of the parity bits is reversed compared to the endianness of the data bits:\n", "The endianness of the parity bits is reversed compared to the endianness of the data bits:\n",
"Data bits are encoded most significant bit first and the parity bits encoded least significant bit first.\n", "Data bits are encoded most significant bit first and the parity bits encoded least significant bit first.\n",
"The parity bit at position 0 is set last.\n\n", "The parity bit at position 0 is set last.\n\n",
"Examples:\n", "Examples:\n\n",
"8 in binary is 1000, and encodes to 11110000 (pppdpddd - where p is a parity bit and d is a data bit)\n", "8 in binary is 1000, and encodes to 11110000 (pppdpddd - where p is a parity bit and d is a data bit)\n",
"21 in binary is 10101, and encodes to 1001101011 (pppdpdddpd)\n\n", "21 in binary is 10101, and encodes to 1001101011 (pppdpdddpd)\n\n",
"For more information on the 'rule' of encoding, refer to Wikipedia (https://wikipedia.org/wiki/Hamming_code)", "For more information on the 'rule' of encoding, refer to Wikipedia (https://wikipedia.org/wiki/Hamming_code)",
@ -1329,7 +1329,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
`'${n}' \n\n`, `'${n}' \n\n`,
"Decode it as an 'extended Hamming code' and convert it to a decimal value.\n", "Decode it as an 'extended Hamming code' and convert it to a decimal value.\n",
"The binary string may include leading zeroes.\n", "The binary string may include leading zeroes.\n",
"Parity bits are inserted at positions 0 and 2^N.\n", "A parity bit is inserted at position 0 and at every position N where N is a power of 2.\n",
"Parity bits are used to make the total number of '1' bits in a given set of data even.\n", "Parity bits are used to make the total number of '1' bits in a given set of data even.\n",
"The parity bit at position 0 considers all bits including parity bits.\n", "The parity bit at position 0 considers all bits including parity bits.\n",
"Each parity bit at position 2^N alternately considers 2^N bits then ignores 2^N bits, starting at position 2^N.\n", "Each parity bit at position 2^N alternately considers 2^N bits then ignores 2^N bits, starting at position 2^N.\n",
@ -1338,7 +1338,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"The parity bit at position 0 is set last.\n", "The parity bit at position 0 is set last.\n",
"There is a ~55% chance for an altered bit at a random index.\n", "There is a ~55% chance for an altered bit at a random index.\n",
"Find the possible altered bit, fix it and extract the decimal value.\n\n", "Find the possible altered bit, fix it and extract the decimal value.\n\n",
"Examples:\n", "Examples:\n\n",
"'11110000' passes the parity checks and has data bits of 1000, which is 8 in binary.\n", "'11110000' passes the parity checks and has data bits of 1000, which is 8 in binary.\n",
"'1001101010' fails the parity checks and needs the last bit to be corrected to get '1001101011',", "'1001101010' fails the parity checks and needs the last bit to be corrected to get '1001101011',",
"after which the data bits are found to be 10101, which is 21 in binary.\n\n", "after which the data bits are found to be 10101, which is 21 in binary.\n\n",
@ -1531,7 +1531,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"You are given the following input string:\n", "You are given the following input string:\n",
`    ${plaintext}\n`, `    ${plaintext}\n`,
"Encode it using run-length encoding with the minimum possible output length.\n\n", "Encode it using run-length encoding with the minimum possible output length.\n\n",
"Examples:\n", "Examples:\n\n",
"    aaaaabccc            ->  5a1b3c\n", "    aaaaabccc            ->  5a1b3c\n",
"    aAaAaA               ->  1a1A1a1A1a1A\n", "    aAaAaA               ->  1a1A1a1A1a1A\n",
"    111112333            ->  511233\n", "    111112333            ->  511233\n",
@ -1618,7 +1618,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"You are given the following LZ-encoded string:\n", "You are given the following LZ-encoded string:\n",
`    ${compressed}\n`, `    ${compressed}\n`,
"Decode it and output the original string.\n\n", "Decode it and output the original string.\n\n",
"Example: decoding '5aaabb450723abb' chunk-by-chunk\n", "Example: decoding '5aaabb450723abb' chunk-by-chunk\n\n",
"    5aaabb           ->  aaabb\n", "    5aaabb           ->  aaabb\n",
"    5aaabb45         ->  aaabbaaab\n", "    5aaabb45         ->  aaabbaaab\n",
"    5aaabb450        ->  aaabbaaab\n", "    5aaabb450        ->  aaabbaaab\n",