flip, duplicate columns, flip again

This commit is contained in:
Baipyrus 2023-12-12 10:13:38 +01:00
parent 49cbce92e9
commit 8b72c18d65

View File

@ -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`);