Skip to content

Commit 1acb857

Browse files
committed
WIP day10
1 parent 3d2f9e7 commit 1acb857

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

day10/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,28 @@ func rPool(p int, n []int, c []int, cc [][]int, minLength int, high int) [][]int
197197
return cc
198198
}
199199
p--
200+
200201
for i := range n {
201202
r := make([]int, len(c)+1)
202203
copy(r, c)
204+
203205
r[len(r)-1] = n[i]
204206
if p == 0 {
205-
206207
if len(r) > minLength && high-r[len(r)-1] < 4 && r[0]-0 < 4 {
207208
log.Printf("adding %+v", r)
208209
cc = append(cc, r)
209210
}
210211
}
211212

212-
if len(r) > 1 && r[len(r)-1]-r[len(r)-2] > 3 {
213-
continue
213+
if len(r) > 1 {
214+
if r[len(r)-1]-r[len(r)-2] > 3 {
215+
continue
216+
}
217+
if r[0]-0 > 3 {
218+
continue
219+
}
214220
}
221+
215222
cc = rPool(p, n[i+1:], r, cc, minLength, high)
216223

217224
}

0 commit comments

Comments
 (0)