mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
fix formatting of Spiralize Matrix contract
This commit is contained in:
@@ -152,23 +152,34 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
||||
"Given the following array of array of numbers representing a 2D matrix,",
|
||||
"return the elements of the matrix as an array in spiral order:\n\n",
|
||||
].join(" ");
|
||||
for (const line of n) {
|
||||
d += `${line.toString()},\n`;
|
||||
}
|
||||
// for (const line of n) {
|
||||
// d += `${line.toString()},\n`;
|
||||
// }
|
||||
d += " [\n";
|
||||
d += n
|
||||
.map(
|
||||
(line: number[]) =>
|
||||
" [" +
|
||||
line.map((x: number) => `${x}`.padStart(2, " ")).join(",") +
|
||||
"]",
|
||||
)
|
||||
.join("\n");
|
||||
d += "\n ]\n";
|
||||
d += [
|
||||
"\nHere is an example of what spiral order should be:",
|
||||
"\nExample:",
|
||||
"\nHere is an example of what spiral order should be:\n\n",
|
||||
" [\n",
|
||||
" [1, 2, 3],\n",
|
||||
" [4, 5, 6],\n",
|
||||
" [1, 2, 3]\n",
|
||||
" [4, 5, 6]\n",
|
||||
" [7, 8, 9]\n",
|
||||
" ] should result in [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n",
|
||||
"Note that the matrix will not always be square:\n",
|
||||
" ]\n\n",
|
||||
"Answer: [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n",
|
||||
"Note that the matrix will not always be square:\n\n",
|
||||
" [\n",
|
||||
" [1, 2, 3, 4]\n",
|
||||
" [5, 6, 7, 8]\n",
|
||||
" [9, 10, 11, 12]\n",
|
||||
" ] should result in [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7",
|
||||
" [1, 2, 3, 4]\n",
|
||||
" [5, 6, 7, 8]\n",
|
||||
" [9, 10, 11, 12]\n",
|
||||
" ]\n\n",
|
||||
"Answer: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]",
|
||||
].join(" ");
|
||||
|
||||
return d;
|
||||
|
||||
Reference in New Issue
Block a user