Ad
  • Custom User Avatar

    Genralized tip:

    def kata_solution(arg):
        print(arg)
    

    You'll fail all the test, but usually you'll see the input. (Except, as you'll discover here, not always.)

    def kata_solution(arg):
      pass
    

    Often this will help you find out the count of tests. (Although, again not always.)

    I was able to reach 65 tests, but still timed out. I suspect we're using the same algorithm (but I've optimized mine as much as possible). I have in mind another algorithm which I think may be faster, but don't have time to implement it at the moment. I'd encourage you to try a different approach. 232 people have solved it in Python, so it should be doable.

    No spoilers, sorry. :)

  • Custom User Avatar

    correct me if i'm wrong,
    but the challange here is actually mapping all primes up to given number in an optimized way.
    i know i have an efficient method, but it still isn't good enough to pass in given time.
    (going through odds only, using bitwise,etc.)
    it seems like there isn't a wide range of deviation from a specific code to succeed.
    no space was left for discussing solutions, best practices, algorithms - either you got it or you didn't.
    well... i didn't.
    and the only ones that can discuss it probably did almost the same.
    no one can learn from no one here, although it could be a very good well to drink from.

    please think about softening a bit the requirements, allowing some that almost passed to succeed and learn from better coders.

  • Custom User Avatar

    hi there!
    my code passed 55 (example + short), but T.O in large ones.
    running python.
    already O(log n), and not sure how to reduce it further.
    was it tested using python on servers? can it get better than O(log n)?

    edit:
    on my 6y.o laptop i get 50 tests of 106-digits in split of a second:
    number: 1234567890123456789111111111111111111111111111111111112345678901234567891111111111111111111111111111111111 size: 350 array: [1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1]
    Action took 0.00 seconds

    how big are the big numbers?

  • Custom User Avatar

    thank you! :)

  • Custom User Avatar

    Also, you might wanna search it up on wikipedia, if you don't succeed yourself. There's a nuance that could potentially not let you pass.

  • Custom User Avatar

    O(n*sqrt(n)*m) per entire test suite, where m is the number of tests isn't supposed to pass. Gotta reduce this somehow. Remember about the upper bound.

  • Custom User Avatar

    while my code is correct, i keep failing at test 10# on timeout.
    is O(n*sqrt(n)) supposed to be good enough?

  • Custom User Avatar

    the idea is sweet, but thetesting is quirky.

    1. if there are only 2 characters, it isn't logical there's a space in between, but a 2-character word.
    2. some letters are a longer variation of others: - T, --- O ; . E, .. I, ... S ;
      normalizing signals should take in consideration one might appear as another.
    3. padding with 0s before and after is irrelevant. code could trim it, but a signal starts with a signal, not not-signal.

    there should be a convention of how to start messaging, orregarding message requirements.

  • Custom User Avatar

    got that too in python.
    i print the message before returning it, and it's the same.