diff --git a/src/advent/util.cr b/src/advent/util.cr index 52b8c3b..1bcce64 100644 --- a/src/advent/util.cr +++ b/src/advent/util.cr @@ -33,6 +33,14 @@ class Array(T) puts end end + + def find_indices + into = [] of T + each_with_index do |v, i| + into << i if yield v + end + into + end end struct Tuple(*T)