I'm attempting to write an algo that returns an array of all possible combinations for values 0, 1, and 2 for length n.
For example where n = 2:
00
01
02
10
11
12
20
21
22
Code that I have started but far from right or finished:
func main() {
var results []string
matches := rangeSlice(2)
for a := 0; a < len(matches); a++ {
for b := 0; b < 3; b++ {
matches[(len(matches) - a) - 1] = b
results = append(results, strings.Join(convertValuesToString(matches), ""))
}
}
printResults(results)
}
Your help would be much appreciated!