aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-12-15 00:51:29 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-12-15 00:51:29 +0100
commitc15ce118475359c87f118646514291eeec08ceff (patch)
tree3a771ebc4024e14638f92a94b3527ed6c132c254
parentdf25235f1e020f943397a28d6a87c6d84b542c17 (diff)
Add 2019 day 4 solutions
-rw-r--r--2019/04/.gitignore1
-rw-r--r--2019/04/Makefile1
-rw-r--r--2019/04/puzzles.sh8
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