aoc/aoc2015/day01.go

28 lines
335 B
Go
Raw Normal View History

2024-07-24 14:29:59 +00:00
package aoc2015
import (
2024-07-24 18:03:39 +00:00
"aoc/internal/utility"
2024-07-24 14:29:59 +00:00
"fmt"
)
func day01() {
2024-07-24 18:03:39 +00:00
in := utility.GetInput("input/2015/01")
2024-07-24 14:29:59 +00:00
floor, p2 := 0, 0
found := false
for i, c := range in {
if c == '(' {
floor++
} else {
floor--
}
if floor == -1 && !found {
found = true
p2 = i + 1
}
}
fmt.Println(floor)
fmt.Println(p2)
}