2022 day 6: C (parts 1 and 2)

This commit is contained in:
2022-12-09 16:24:13 +01:00
parent 05643127c2
commit 9c999e9717
3 changed files with 69 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ solve() {
for ((j = 0; j < lcur; ++j)); do # compare with previous ones
if [[ $next == "${cur:j:1}" ]]; then # duplicate
cur="${cur:j+1}$next" # keep str after dup + new char
(( lcur = lcur - j ))
(( lcur -= j ))
continue 2
fi
done