23 lines
420 B
JavaScript
23 lines
420 B
JavaScript
import * as R from "remeda";
|
|
import { readFile } from "../05/part1.js";
|
|
|
|
export const puzzleInput = readFile(import.meta.url, "input");
|
|
|
|
export default function (code) {
|
|
const size = 4;
|
|
let index = size;
|
|
|
|
while (true) {
|
|
if (
|
|
R.pipe(
|
|
code,
|
|
(c) => c.substr(index - size, size).split(""),
|
|
R.uniq,
|
|
(c) => c.length
|
|
) === size
|
|
)
|
|
return index;
|
|
index++;
|
|
}
|
|
}
|