Ad
  • Custom User Avatar

    If your solution loops 1_000_000 times while it could loop only 1_000 times, I would not call it correct even if it returns expected results.
    If your solution loops 1_000_000 times while it could loop only 1 time, it's even more incorrect in my opinion.

    Additionally, all what you need to make it correct is to modify one place and add one call to a function which you learn in school, so, in my opinion, it's still in scope of this kyu.

    My mistake is that I did not put the range in description or sample tests, so currently user timeouts only on full attempt. This is my bad, and I am going to fix this.

  • Custom User Avatar

    Hi @Agboola O.D., please remember to always use the spoiler tag when posting code. (I have added the tag) When you click ATTEMPT, there are usually more extensive tests, including random tests. If the solution is correct but still times out, you'll need to optimize the solution further.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • Read this point of the FAQ, especially first bullet point. It's probably the only one which applies to your situation
    • Read through posts below. Unfortunately, many of them is marked as spoilers, but you might be able to find something useful.
    • Do some more research. Google, read, work with pen and paper. Try to find out how far you have to loop to be able to determine that number is prime. Hint: it's not n, nor n/2, nor n/4, nor...
    • It depends on language version, but in most of them, numbers go up to 2_000_000_000. It might seem scary, but it's easier than one would expect.

    I plan on adding more information on range of tested numbers to the description, so it would be known from beginning.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution