From a9100b6fc9126c88e2006ed72fb73369afba9773 Mon Sep 17 00:00:00 2001 From: Kharec Date: Sat, 3 Jan 2026 12:15:19 +0100 Subject: [PATCH] feat: solve part two --- internal/2017/DayFive/code.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/2017/DayFive/code.go b/internal/2017/DayFive/code.go index 9ef2e8d..aed64dc 100644 --- a/internal/2017/DayFive/code.go +++ b/internal/2017/DayFive/code.go @@ -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 }