feat: add p2 solution

This commit is contained in:
2025-11-28 17:59:03 +01:00
parent a3f54530f6
commit ff4b7b281c

View File

@@ -39,5 +39,30 @@ func PartOne(data string) int {
}
func PartTwo(data string) int {
return 0
houses := make(map[coordinates]int)
santaX, santaY := 0, 0
robotX, robotY := 0, 0
houses[coordinates{0, 0}] = 2
for idx, direction := range data {
var x, y *int
if idx%2 == 0 {
x, y = &santaX, &santaY
} else {
x, y = &robotX, &robotY
}
switch direction {
case '>':
*x++
case '<':
*x--
case '^':
*y++
case 'v':
*y--
}
houses[coordinates{*x, *y}]++
}
return len(houses)
}