This commit is contained in:
2025-11-11 03:44:20 +01:00
parent a92b8a7cd9
commit 474161741f
2 changed files with 32 additions and 0 deletions

14
src/2015/1/1/index.ts Normal file
View File

@@ -0,0 +1,14 @@
export default async function runner(input: string){
const inStr = await Bun.file(input).text();
let floor = 0;
for(const char of inStr){
if(char === '('){
floor++;
} else if(char === ')'){
floor--;
}
}
console.log(floor);
}

18
src/2015/1/2/index.ts Normal file
View File

@@ -0,0 +1,18 @@
export default async function runner(input: string){
const inStr = await Bun.file(input).text();
let floor = 0;
let index = 0;
for(const char of inStr){
index++;
if(char === '('){
floor++;
} else if(char === ')'){
floor--;
}
if(floor === -1){
console.log(index);
break;
}
}
}