challenge 2d-array

This commit is contained in:
Lorenzo Iovino 2024-01-23 16:38:36 +01:00
parent 10d13dc384
commit 069cfb45fe
7 changed files with 229 additions and 41 deletions

View 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);
})
})
})