12 lines
286 B
Go
12 lines
286 B
Go
|
package d5
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
func P2(input string) int {
|
||
|
lines := strings.Split(strings.TrimSpace(input), "\n")
|
||
|
segments := createSegments(lines)
|
||
|
points := generatePointsWithDiagonals(segments)
|
||
|
intersections := findIntersections(points)
|
||
|
return countIntersections(intersections)
|
||
|
}
|