diff --git a/12/main.go b/12/main.go index 4fda966..0d11243 100644 --- a/12/main.go +++ b/12/main.go @@ -77,7 +77,8 @@ func descend(rooms map[string]room, currentRoom string, path []string, success c wg.Add(1) go func(link string, path []string) { defer wg.Done() - descend(rooms, link, path, success, canVisitSmallRoomTwice) + // in day 2, skip checks once we know we've visited a small room twice + descend(rooms, link, path, success, canVisitSmallRoomTwice && !doubleSmallAlready(newPath)) }(link, newPath) } }