2022-19 in js

This commit is contained in:
Julien Dessaux 2022-12-28 20:03:29 +01:00
parent ece85a2e99
commit 3430a7074b
Signed by: adyxax
GPG key ID: F92E51B86E07177E
11 changed files with 358 additions and 32 deletions

View file

@ -28,7 +28,7 @@ function solve(input) {
let [x, y, z] = line.split(",").map(n => parseInt(n));
min = Math.min(min, x, y, z);
max = Math.max(max, x, y, z);
})
});
min -=1;
max +=1;
// start with an edge and fill up the space
@ -40,7 +40,7 @@ function solve(input) {
const eltstr = elt.join(",");
const [x, y, z] = elt;
if (x < min || x > max || y < min || y > max || z < min || z > max) continue;
if (visited.has(eltstr)) continue
if (visited.has(eltstr)) continue;
if (input.includes(eltstr)) continue;
visited.add(eltstr);
count += countSides(x, y, z, input);