2025 Day 10 Solved!

This commit is contained in:
2025-12-10 11:20:57 -06:00
parent a980fd721b
commit 4e09d431cb
8 changed files with 639 additions and 0 deletions

20
helpers/slice.go Normal file
View File

@@ -0,0 +1,20 @@
package aoc
func CombinationsWithReplacement[T any](input []T, n int) [][]T {
var helper func(int, int, []T)
result := [][]T{}
helper = func(start int, remaining int, current []T) {
if remaining == 0 {
combination := make([]T, len(current))
copy(combination, current)
result = append(result, combination)
return
}
for i := start; i < len(input); i++ {
helper(i, remaining-1, append(current, input[i]))
}
}
helper(0, n, []T{})
return result
}