DAY 1:
O(n^3) 😅
package days
import (
"fmt"
inputs "../inputs"
)
// One : advent of code, day one part1 and 2
func One() {
inputSlice := inputs.Day1
for i := 0; i < len(inputSlice); i++ {
for j := i + 1; j < len(inputSlice); j++ {
for y := j + 1; y < len(inputSlice); y++ {
if (inputSlice[i] + inputSlice[j] + inputSlice[y]) == 2020 {
fmt.Println(inputSlice[i] * inputSlice[j] * inputSlice[y])
}
}
}
}
}
Top comments (0)