3 kyu

Prime counting

Description
Loading description...
Mathematics
Recursion
Algorithms
Memoization
Performance
Number Theory
  • Please sign in or sign up to leave a comment.
  • Origami Master Avatar

    This comment has been hidden.

  • Origami Master Avatar

    Are the test cases always going to be primes, or do I have to check for that too?

  • CodeSenseiMike Avatar

    although unfortunately my solution also time out, and i couldn't optimize my code to not time out.....so i decided to look at the solutions and run them...to my surprise i found that when i ran any of the solutions they all time out!!! how is this possible?are there any solutions that could accept time out?if so, why in my case couldn't i accept time out?

  • Jos-Craw Avatar

    help...what should I use? I take 207 tests, but no more. or does 254+, but everything is wrong

  • user5880445 Avatar

    This comment has been hidden.

  • gruffmeister Avatar

    This comment has been hidden.

  • abrunk Avatar

    Tried several ways to do this but keep timing out at the higher levels. Anyone who completed willing to give a hint?

    Is the correct solution to use a sieve to generate the primes or to use a formula to determine the number? When I try the former it keeps timing out, when I try the latter none of the libraries that have the needed functionality seem to be available.

  • Mkit Avatar

    Hi I've tried everything that I could but still I have problem with execution time. my program manage to solve maximum 114 problems. What can I do with it??

  • igsm7 Avatar

    This comment has been hidden.

  • distortedsignal Avatar

    Something weird is going on here.

    I wrote up a simple Sieve for this, but I can't seem to get it to fail in consistent ways. The main issue that I'm experiencing is that I'm timing out, and I accept that, but I'm also failing test cases in off-by-one ways, and that's something I can't stand. As an example, for one attempt, I'll get a test error that says:

    37673 should equal 37674

    and that will be the only test error that isn't the timeout, and for the next test, where I only change the whitespace, I'll get two errors:

    41674 should equal 41675

    9170 should equal 9171

    It would be good to know what test n I actually fail where n is passed into the function. It would be more helpful to change the text that reports an error to be something like "There are {correct_count} of primes below {passed_in_n}, code returned {n}."

  • 66  Avatar

    Please review: C++ Translation

  • dolamroth Avatar

    It seems, most solutions got invalidated due to buffer overload. And it's partially due to reference solution, which also takes a lot of memory.

  • dolamroth Avatar

    It seems, most solutions got invalidated due to buffer overload. And it's partially due to reference solution, which also takes a lot of memory.

  • monadius Avatar

    This comment has been hidden.

  • dolamroth Avatar

    69, 420, 666

    You have some good taste, nice

  • dfhwze Avatar

    This kyu 2 is nothing compared to this :)