day 6 simplify ivy solution and fix an off-by-n bug
parent
259fc5cf02
commit
9848440f3f
|
@ -11,13 +11,8 @@ op i loop a =
|
|||
(i+1) loop a
|
||||
|
||||
op solve n =
|
||||
i = ((1-n) drop iota rho input) o.+ (-1 + iota n)
|
||||
1 loop input[i]
|
||||
|
||||
# if we were using rsc's @ patch then we could just do
|
||||
# (unique@ input[i]) iota 1
|
||||
# instead of
|
||||
# i loop input[i]
|
||||
i = iota n
|
||||
(i loop input)[-1]
|
||||
|
||||
solve 4
|
||||
solve 14
|
||||
|
|
Loading…
Reference in New Issue