28 lines
331 B
Go
28 lines
331 B
Go
|
package aoc2015
|
||
|
|
||
|
import (
|
||
|
"aoc/internal/input"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func day01() {
|
||
|
in := input.GetInput("input/2015/01")
|
||
|
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)
|
||
|
}
|