-
-
Save ljyang/ef852e4f77980b0546cb4a8e2b1b1d01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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