Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks. Got it. I make a mistake.
There is no issue.
Try again? ;-)
Is this issue had been fixed?
Yes but the lcm of 130,131,4 is 34060...
rust test cases seem to be wrong
the lcm of 1300,1310,40 is 340600
this is different than the test case
34060
see: https://www.wolframalpha.com/input/?i=lcm(1300,1310,40)
i
should be ofsize_t
otherwise with a sufficiently large x your loop will never terminate. You will get a warning if compiled with -Wall : signed unsigned comparison.Also
s
does not change in the loop. The speed calculation can be hoised out leving the loop only having to calculatemax_dist
.i
should be ofsize_t
otherwise you can get (with -Wall)signed unsigned comparison
. Also with a sufficiently largex
your loop will never terminate.the value of
s
does not alter with the loop therefore you can hoist out the calculation ofav_speed
. i.e. use the loop to findmax_section
thenreturn std::floor(3600 * max_secion / s);
The calculation of V is being discarded in every loop. the value of S does not change in the loop. Move calculation of V to outside of the loop after finding max delta.
this requires O(n) extra space. This can be done using O(1) extra space.
unused local variable
speed