diff --git a/day-01/internal/two/solve.go b/day-01/internal/two/solve.go index 2d16959..405aad3 100644 --- a/day-01/internal/two/solve.go +++ b/day-01/internal/two/solve.go @@ -34,9 +34,10 @@ func Solve() (int, error) { var occurrences int for _, n := range right[indx:] { - if n == k { - occurrences++ + if n > k { + break } + occurrences++ } similarity += k * v * occurrences }