blob: c19e1da7784a668d2857d3975c42b00eb617e466 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
d=require("fs").readFileSync("input", "utf8").split("")
function solve(k)
{
return d.map((_,i)=>d.slice(i,i+k)).findIndex(a=>(new Set(a)).size==a.length)+k
}
const tic = performance.now();
console.log(solve(4));
console.log(solve(14));
const toc = performance.now();
console.log("TIME: " + ((toc - tic) / 1000).toFixed(6) + " seconds");
|