Simplified some booleans and if elses

This commit is contained in:
BB
2022-03-01 20:37:47 +01:00
parent 570b8caf78
commit 0eced1b9f2
10 changed files with 15 additions and 48 deletions

View File

@@ -307,15 +307,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
reach = Math.max(i + data[i], reach);
}
const solution: boolean = i === n;
if (ans === "1" && solution) {
return true;
}
if (ans === "0" && !solution) {
return true;
}
return false;
return (ans === "1" && solution) || (ans === "0" && !solution);
},
},
{
@@ -921,7 +913,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"The provided answer should be an array of strings containing the valid expressions.",
"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",
`["${digits}", ${target}]\n\n`,
`["${digits}", ${target}]\n\n`,
"NOTE: The order of evaluation expects script operator precedence",
"NOTE: Numbers in the expression cannot have leading 0's. In other words,",
`"1+01" is not a valid expression`,