This commit is contained in:
Aelita4 2022-12-05 21:32:22 +01:00
parent 29e6254438
commit 41abdea33b
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
1 changed files with 7 additions and 1 deletions

View File

@ -29,8 +29,14 @@ input.split('\n').forEach(line => {
const howMany = parseInt(splitLine[1]), from = parseInt(splitLine[3]) - 1, to = parseInt(splitLine[5]) - 1; const howMany = parseInt(splitLine[1]), from = parseInt(splitLine[3]) - 1, to = parseInt(splitLine[5]) - 1;
const tempStack = [];
for(let i = 0; i < howMany; i++) { for(let i = 0; i < howMany; i++) {
stacks[to].push(stacks[from].pop()); tempStack.push(stacks[from].pop());
}
for(let i = 0; i < howMany; i++) {
stacks[to].push(tempStack.pop())
} }
} }
}); });