diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-12-15 00:51:29 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-12-15 00:51:29 +0100 |
commit | c15ce118475359c87f118646514291eeec08ceff (patch) | |
tree | 3a771ebc4024e14638f92a94b3527ed6c132c254 /2019/04 | |
parent | df25235f1e020f943397a28d6a87c6d84b542c17 (diff) |
Add 2019 day 4 solutions
Diffstat (limited to '2019/04')
-rw-r--r-- | 2019/04/.gitignore | 1 | ||||
-rw-r--r-- | 2019/04/Makefile | 1 | ||||
-rw-r--r-- | 2019/04/puzzles.sh | 8 |
3 files changed, 10 insertions, 0 deletions
diff --git a/2019/04/.gitignore b/2019/04/.gitignore new file mode 100644 index 0000000..dd596dd --- /dev/null +++ b/2019/04/.gitignore @@ -0,0 +1 @@ +puzzle-[12].sh
\ No newline at end of file diff --git a/2019/04/Makefile b/2019/04/Makefile new file mode 100644 index 0000000..2e36725 --- /dev/null +++ b/2019/04/Makefile @@ -0,0 +1 @@ +include ../../Makefiles/sh.mk
\ No newline at end of file diff --git a/2019/04/puzzles.sh b/2019/04/puzzles.sh new file mode 100644 index 0000000..b3bcfed --- /dev/null +++ b/2019/04/puzzles.sh @@ -0,0 +1,8 @@ +IFS=- read lo hi <input +seq $lo $hi | + grep -E '([0-9])\1' | + grep -E '^0*1*2*3*4*5*6*7*8*9*$' | + # START PART 2 + grep -E '^(0{2}1*2*3*4*5*6*7*8*9*|0*1{2}2*3*4*5*6*7*8*9*|0*1*2{2}3*4*5*6*7*8*9*|0*1*2*3{2}4*5*6*7*8*9*|0*1*2*3*4{2}5*6*7*8*9*|0*1*2*3*4*5{2}6*7*8*9*|0*1*2*3*4*5*6{2}7*8*9*|0*1*2*3*4*5*6*7{2}8*9*|0*1*2*3*4*5*6*7*8{2}9*|0*1*2*3*4*5*6*7*8*9{2})$' | + # END PART 2 + wc -l
\ No newline at end of file |