want to see how I did i t?
# advent-of-code
b
want to see how I did i t?
n
You just take the minimum of the moduli of the bus ID's by the departure time?
min of departureTime % busId
b
no
I'm taking the solution where any bus has a time % pos == 0
incrementing time
n
ah I see my mistake, i'm referencing the bus just before instead of the one just after
the correct operation is (departureTime / busId).ceiling() * busId - departureTIme
b
if you do it that way
I'm not sure why you do it that way
n
what's wrong with that way?
it seems the fastest way possible
b
dunno it is instantaneous for me
didn't run benchs
n
I'm too tired to continue but it seems like all the bus ID's are prime
b
yes
n
that's almost certainly exploitable
b
I think I have it
n
pretty sure you can essentially do them two at a time and build it up... anyway will have ago tomorrow
e
@Nir Instead of
ceiling()
I do
+ 1
, maybe that's it.
kotlin.math.ceil(5.0) == 5.0
, but maybe your
ceiling()
is different.
n
@Edgars it should be floor I think because you would be waiting 0 in that case
E.g. time 15, bus ID of 5
3.0.ceilong() * 5 - 15 = 0 as desired
e
Yeah, it doesn't work for that, but it worked for the test input and my input. 😄