6 kyu
Pairs adding up to primes
47lil2
Loading description...
Algorithms
Mathematics
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
In big random test, the range of
n
is0 - 1e5
. This can be changed to1e4 - 1e5
to ensure that all generated numbers are large integer.Done!
It might be redundant information to some, but I would add to the description:
Added it
The current test setup is incorrect:
test.describe
blocks are not terminated bytest.it
blocks, which causes formatting issues and the inability to display runtime.Fixed it. Still not sure if its the right way to do it, let me know.
Duplicate of https://www.codewars.com/kata/587a45b954a6780e37000176
However, your kata has much larger input arrays, which justifies it.
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
to2n
, which admits different kinds of solutions.One of the assertion groups:
I passed 71 tests before hitting time out. You sure it's 50?
Well it was 50 calls of the function but I was actually making two assertions. I think its not how tests are supposed to be designed so I changed that.
.
Function name is wrong (initially
pairs
but expectsmake_pairs
)I'm guessing the
=6
is a typo here? otherwise I'm not understanding what you're trying to communicate.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.Fixed the function name
Yeah the =6 is just the example. Will change it if it confuses people