Skip to content

Instantly share code, notes, and snippets.

@ljyang
Last active December 6, 2022 18:52
Show Gist options
  • Save ljyang/ef852e4f77980b0546cb4a8e2b1b1d01 to your computer and use it in GitHub Desktop.
Save ljyang/ef852e4f77980b0546cb4a8e2b1b1d01 to your computer and use it in GitHub Desktop.
PART2
#!/bin/bash
input=`cat input.txt`
for (( c=14; c -lt $(#input); c++ )); do
if [ `echo ${input:((c-14)):14} | fold -w1 | sort -u | wc -l | xargs` -eq 14 ]; then
echo "solution is: $c"
break
fi
done
PART1
#!/bin/bash
input=`cat input.txt`
for (( c=4; c -lt $(#input); c++ )); do
if [ `echo ${input:((c-4)):4} | fold -w1 | sort -u | wc -l | xargs` -eq 4 ]; then
echo "solution is: $c"
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment