mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2025-04-20 03:03:47 +01:00
Compare commits
No commits in common. "0f357df19d8732d423228af990880c85a1e95ec8" and "9ba5ad695e71217c33422124759fd83bc6af06d9" have entirely different histories.
0f357df19d
...
9ba5ad695e
@ -16,9 +16,8 @@ type bound struct {
|
||||
}
|
||||
|
||||
// newBound returns a bound type
|
||||
// it defines an open ended interval
|
||||
func newBound(lower, upper int) bound {
|
||||
return bound{lower: lower, upper: upper - 1}
|
||||
return bound{lower: lower, upper: upper}
|
||||
}
|
||||
|
||||
// nextTransform recursively calculates each new set of seed ranges for each set of data in dataMap
|
||||
@ -43,10 +42,10 @@ func nextTransform(i int, in []bound) []bound {
|
||||
|
||||
// append unmatched portions of seed range back into queue
|
||||
if start > r.lower {
|
||||
q.enqueue(newBound(r.lower, start))
|
||||
q.enqueue(newBound(r.lower, start-1))
|
||||
}
|
||||
if r.upper > end {
|
||||
q.enqueue(newBound(end, r.upper))
|
||||
q.enqueue(newBound(end, r.upper-1))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user