Compare commits
3 Commits
77a352aa2e
...
ea037debed
| Author | SHA1 | Date | |
|---|---|---|---|
| ea037debed | |||
| a0a0c43690 | |||
| bce49d51f7 |
@@ -45,11 +45,11 @@ func TestPartTwo(t *testing.T) {
|
||||
|
||||
PartTwo(input)
|
||||
|
||||
w.Close()
|
||||
_ = w.Close()
|
||||
os.Stdout = oldStdout
|
||||
|
||||
var buffer bytes.Buffer
|
||||
buffer.ReadFrom(r)
|
||||
_, _ = buffer.ReadFrom(r)
|
||||
got := strings.TrimSpace(buffer.String())
|
||||
|
||||
if got != expected {
|
||||
|
||||
@@ -91,7 +91,7 @@ func PartTwo(data []string) int {
|
||||
return false
|
||||
}
|
||||
for _, c := range value[1:] {
|
||||
if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) {
|
||||
if (c < '0' || c > '9') && (c < 'a' || c > 'f') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,8 @@ func init() {
|
||||
func ParseInput(filepath string) []string {
|
||||
content, _ := os.ReadFile(filepath)
|
||||
lines := strings.Split(string(content), "\n")
|
||||
var data []string
|
||||
for _, line := range lines {
|
||||
data = append(data, line)
|
||||
}
|
||||
return data
|
||||
data := make([]string, 0, len(lines))
|
||||
return append(data, lines...)
|
||||
}
|
||||
|
||||
func PartOne(data []string) int {
|
||||
|
||||
Reference in New Issue
Block a user