Browse Source

I know why it is wrong, but cannot fix now

master
Alexander Avery 3 weeks ago
parent
commit
745bb5c16f
  1. 8
      2024/day02.go

8
2024/day02.go

@ -47,6 +47,14 @@ Scan:
return printi(sum)
}
// part 2 does not yet work because this code makes a false assumption.
// that assumption is that in order to fix a broken level, you can only skip the
// one that made it broken.
//
// this is not true because of the following level
// 5 6 3 2
// 5 and 6 would be OK, so the algorithm will blame the 3 and attempt to skip it.
// the real solution however, is to skip the 6 because it would be fine if all descending
func (d Day2) Part2(r io.Reader) string {
s := bufio.NewScanner(r)
var sum int

Loading…
Cancel
Save