6 kyu

Pairs adding up to primes

Description
Loading description...
Algorithms
Mathematics
  • Please sign in or sign up to leave a comment.
  • SmallWolfxDDD Avatar

    In big random test, the range of n is 0 - 1e5. This can be changed to 1e4 - 1e5 to ensure that all generated numbers are large integer.

  • dfhwze Avatar

    It might be redundant information to some, but I would add to the description:

    Each number in the set has to be used exactly once

  • Voile Avatar

    The current test setup is incorrect: test.describe blocks are not terminated by test.it blocks, which causes formatting issues and the inability to display runtime.

    • lil2 Avatar

      Fixed it. Still not sure if its the right way to do it, let me know.

      Issue marked resolved by lil2 8 months ago
  • uttumuttu Avatar

    Duplicate of https://www.codewars.com/kata/587a45b954a6780e37000176

    However, your kata has much larger input arrays, which justifies it.

    • Voile Avatar

      It's not a duplicate. The integers to be paired in that kata is arbitrary, so only brute-force is viable. This kata specifically pairs up integers from 1 to 2n, which admits different kinds of solutions.

  • Mednoob Avatar

    One of the assertion groups:

    Random big tests (50 tests with n < 10**5)
    

    I passed 71 tests before hitting time out. You sure it's 50?

  • scarecrw Avatar

    Function name is wrong (initially pairs but expects make_pairs)

    I'm guessing the =6 is a typo here? otherwise I'm not understanding what you're trying to communicate.

    It contains all numbers from 1 to 2*n = 6 once

    It should be stated what range of n values will be tested.

    This is more of a suggestion, but the current error messages are fairly long to the point where running with an incorrect solution often hits the max buffer size. I'd recommend editing those to provide more succinct errors (e.g. instead of listing the entire set of incorrect values, just display the first invalid case).


    Edit: I think I get the =6, as in, for the provided example 2n is 6. Hopefully that's more obvious to others and I was just overlooking it on first read.

    • lil2 Avatar

      Fixed the function name

      Yeah the =6 is just the example. Will change it if it confuses people

      Issue marked resolved by lil2 8 months ago