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.
I guess it's the overflow considerations?
what is meant with the "worst case" ?
If the goal is to pass the test, that's fine. But this code cannot be considered best practice because it does not consider the worst case.
Approved some time ago
A sturdier initial value for
max
could be-math.huge
, which is-inf
when Lua was compiled with floating-point numbers.This comment is hidden because it contains spoiler information about the solution
Prepared Erlang translation:
https://www.codewars.com/kumite/5a4bc2118803859bed00012c
Please review.
Many thanks for your contribution; reviewed and approved :D
No problem.
1-2) Added
All looks great to me by eye but would you mind making the following minor modifications before I approve it?
math.randomseed(os.time())
before executing the random tests. IIRC Lua uses a fixed default seed formath.random()
which means that the sequence of "random" numbers generated will be identical in each program run unless it is explicitly seeded (with the current time).for
loop so that it gets executed at least10
times (and ideally about100
times if possible), like such:Cheers :)
Thank you for your answer.
I was hoping for better solution than copy over final solution to test cases.
Random part in test cases is uncommented and final solution is copied over.
To compare the user solution against a reference solution, you have to define the reference solution in the Test Cases section itself. For example:
Since I don't actually know Lua, I can't guarantee that the code example I provided above would compile (I haven't tested it on an online compiler) but hopefully you get the idea :)
Thank you for feedback.
I am doing translation for the first time, so I don't know the in and outs yet.
interpreter
to ensure consistency between Lua and other language versions.Lua translation Kumited!
https://www.codewars.com/kumite/5a496360b3bfa8aa2900008f/
Please review and approve!