challenge 2d-array
This commit is contained in:
parent
10d13dc384
commit
069cfb45fe
7 changed files with 229 additions and 41 deletions
23
src/2d-array/2d-array.spec.ts
Normal file
23
src/2d-array/2d-array.spec.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import {describe, it, skip} from 'node:test';
|
||||
import * as assert from "node:assert";
|
||||
import {findHighestHourglassSum} from "./2d-array";
|
||||
import {Matrix} from "./matrix";
|
||||
describe("2D Array", () => {
|
||||
describe("findHighestHourglassSum", () => {
|
||||
it("should return 0 if the matrix is empty", () => {
|
||||
assert.equal(findHighestHourglassSum(new Matrix([])), 0);
|
||||
})
|
||||
|
||||
it("should return 19 with this matrix", () => {
|
||||
assert.equal(findHighestHourglassSum(
|
||||
new Matrix([
|
||||
[1, 1, 1, 0, 0, 0],
|
||||
[0, 1, 0, 0, 0, 0],
|
||||
[1, 1, 1, 0, 0, 0],
|
||||
[0, 0, 2, 4, 4, 0],
|
||||
[0, 0, 0, 2, 0, 0],
|
||||
[0, 0, 1, 2, 4, 0]]
|
||||
)), 19);
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue