mirror of
https://github.com/Baipyrus/AoC-23.git
synced 2024-08-16 23:39:43 +00:00
flip, duplicate columns, flip again
This commit is contained in:
parent
49cbce92e9
commit
8b72c18d65
|
@ -15,8 +15,13 @@ const expand = (arr) =>
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const flip = (current) =>
|
||||||
|
Array.from({ length: current[0].length }, (_, x) =>
|
||||||
|
Array.from({ length: current.length }, (_, y) => current[y][x])
|
||||||
|
);
|
||||||
|
|
||||||
console.log(expand(input));
|
const universe = flip(expand(flip(expand(input))));
|
||||||
|
console.log(universe);
|
||||||
|
|
||||||
const t1 = performance.now();
|
const t1 = performance.now();
|
||||||
console.log(`Runtime: ${t1 - t0}ms`);
|
console.log(`Runtime: ${t1 - t0}ms`);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user