diff --git a/2024/day-7/solution-2.awk b/2024/day-7/solution-2.awk index 6e3ec2e..c652a57 100644 --- a/2024/day-7/solution-2.awk +++ b/2024/day-7/solution-2.awk @@ -1,5 +1,8 @@ #!/usr/bin/env awk +# Just pre-compute all possible results +# and check against the sum + BEGIN { FS = "[: ]" total = 0 diff --git a/2024/day-8/solution-1.sh b/2024/day-8/solution-1.sh index 6ea2755..d124161 100644 --- a/2024/day-8/solution-1.sh +++ b/2024/day-8/solution-1.sh @@ -13,10 +13,10 @@ do LINE="$( for (( i=0; i<${#MAP_ARRAY[@]}; i++ )) do - if [[ ${MAP_ARRAY[i]} == "$CHAR" ]] - then - printf "%s " "$i" - fi + if [[ ${MAP_ARRAY[i]} == "$CHAR" ]] + then + printf "%s " "$i" + fi done )" printf "%s\n" "$LINE" >&2