feat: solve part two

This commit is contained in:
2026-01-03 12:15:19 +01:00
parent 096788c592
commit a9100b6fc9

View File

@@ -39,5 +39,22 @@ func PartOne(data []int) int {
}
func PartTwo(data []int) int {
return 0
instructions := make([]int, len(data))
copy(instructions, data)
position := 0
steps := 0
for position >= 0 && position < len(instructions) {
jump := instructions[position]
if jump >= 3 {
instructions[position]--
} else {
instructions[position]++
}
position += jump
steps++
}
return steps
}