12 filename="${1:-input.txt}"
14 for num in $(<"$filename"); do
15 cur_line=$((cur_line+1))
16 windows[$cur_window]=$num
17 if [ $cur_window -gt 1 ]; then
18 ((windows[$((cur_window - 1))]+=$num))
20 if [ $cur_window -gt 2 ]; then
21 ((windows[$((cur_window - 2))]+=$num))
34 if [ $cur_number -gt $prev_number ]; then
42 # remove last 2 entries for windows array
43 unset windows[$((cur_window+1))]
44 unset windows[$((cur_window+2))]
46 echo "$count is the answer"
48 # start from window 2, then we just compare to previous
52 while [ $window -le ${#windows[@]} ]; do
53 if [ ${windows[$((window-1))]} -lt ${windows[$window]} ]; then
59 echo "$count is the 3 value sum answer"