Ad
  • Custom User Avatar

    Here for decodeBits("1110000000111") it return ..., should it be - -?

  • Default User Avatar

    whats going on here, and is this making your computation faster?

  • Custom User Avatar

    Thank you for your reply. I didn't understand the meaning of the question correctly before.

  • Default User Avatar

    The description says:

    Given an array of positive or negative integers I= [i1,..,in] you have to produce a sorted array P of the form ...

    I must be composed of positive or negative integers and 1 is a positive integer so there is no problem in the input. The problem is in your "Actual" since you considered 1 as a prime factor of all elements of the input which is false since 1 is not a prime number (not being a prime number it can't be in this kata considered as a factor). Hence your "actual" is false and the correct answer is "Expect". Cheers.

  • Custom User Avatar

    In the kata instructions, it says

    [ [p, sum of all ij of I for which p is a prime factor (p positive) of ij] ...]

    But it generate random test contains 1 as prime factor(Small probability)

    Testing: 161 116 289 1 343 99 185 397 431
    Actual: (1 2022)(2 116)(3 99)(5 185)(7 504)(11 99)(17 289)(23 161)(29 116)(37 185)(397 397)(431 431)
    Expect: (2 116)(3 99)(5 185)(7 504)(11 99)(17 289)(23 161)(29 116)(37 185)(397 397)(431 431)
    

    I would recommend modifying the test data generator.

  • Custom User Avatar

    I have found the problem which may lead to TLE or MLE, now I have solved it. Nice kata.

  • Custom User Avatar

    Ok, thanks a lot, I will try to optimize my code.

  • Custom User Avatar

    Hi,

    I just tried the python version again and it's working perfectly fine.

    I'm not really sure what you get as error here, but what's sure is that your code is effectively too slow: tests go up to 19 so with 9s up to 9 only, well... ;)
    if the tests are interrupted without any feedback at the end, maybe it's related to an out of memory error (tho, this one generally leads to a totally empty feedback, so... I don't know).

    In any case, this is not a kata issue.

    cheers

  • Custom User Avatar

    run it again and look at the time, it may not be exactly the same... but then, realize this is a 1kyu kata, and again, I assure you the most likely reason you are not passing is because your code is simply not fast enough

  • Custom User Avatar

    Other kata's time limit is usually be set to 12 seconds.

    This kata did not reach 12 seconds, and didn't show any information about time limit, so I have this question.

    Would it be better to add a timeout prompt to the test?

  • Custom User Avatar

    every single kata will time out, so your code is probably not optimized enough to solve this kata

  • Custom User Avatar

    Is there a time limit for this problem?

    I got following log, but not found any message of the reason why it failed

    Time: 9957ms Passed: 1 Failed: 0 Exit Code: 1
    Test Results:
     DivByNTest
     should pass anti-cheat tests
     should pass main test
     Log
    Testing divisibility by 1...
    Testing divisibility by 2...
    Testing divisibility by 3...
    Testing divisibility by 4...
    Testing divisibility by 5...
    Testing divisibility by 6...
    Testing divisibility by 7...
    Testing divisibility by 8...
    Testing divisibility by 9...
    
  • Custom User Avatar

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

  • Custom User Avatar

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