lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, Egor!

I've relatively successfully using Lua for solving HackerRank problems.
(Most tricky part was memory limit, but it was resolved by direct
collectgarbage() call.)

Concerning your algo, try sieve of Eratosthenes. Usually it's
right answer when we need to create table of primes for some segment.

On 17-01-04 04:10 AM, Egor Skriptunoff wrote:
> Hi!
>
> I have made an attempt to use Lua as language for solving problems
> in a programming contest.
> I came across a situation where I can solve a problem using Pascal,
> but not using Lua (4 test cases of 10 were failed due to timeout).
>
> This is the problem I'm talking about:
>
https://www.hackerrank.com/contests/infinitum17/challenges/divisor-exploration-2
> The contest is over, so it is OK to discuss the solutions.
> ...
> My solution (which fails 40% of tests due to timeout):
> http://pastebin.com/tWX8zJEL
> I need to increase its speed by only about 10%.
> But how?