adventofcode2022/day6/solution.ts
2022-12-07 22:32:53 -05:00

14 lines
327 B
TypeScript

import { readFileSync } from 'fs';
import { join } from 'path';
const fileString = readFileSync(join(__dirname, "input"), 'utf-8');
for (var i = 0; i < fileString.length; i++) {
const win = fileString.slice(i, i + 14);
const swin = new Set<string>(win);
if (swin.size == 14) {
console.log(i + 14);
break;
}
}