Retired
Find place of 2 elements in array (retired)
32Tova7
Loading description...
Algorithms
Arrays
Data Types
Arithmetic
Mathematics
Logic
Numbers
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.
You should make some tests in order to return an empty array.
Nobody (so far) takes advantage of the fact that the input array is sorted. But why would we, when even the example solution doesn't ?
What is the point of this kata? What are you trying to showcase with your example solution?
That's a question, not an issue.
As stated below, use either
Test.assertSimilar
orTest.assertDeepEquals
to avoid this:Grouping tests might also be good, same for random testing. I assume you either published by mistake or didn't look at the errors when you hit the button; let me know if I might help in fixing stuff :)
This was fixed.
Duplicate: https://www.codewars.com/kata/two-sum
I'm pretty sure a similar Kata has been authored before already but I can't find it yet - if I find it then it makes this Kata a duplicate.
Other Issues with your test cases:
AFAIK that isn't tested at all in your Test Cases. Either remove it from the Description or add edge assertions to address it.
Again, the tiny number of assertions in your Test Cases means that any brute-force solution can easily pass all tests without timing out. If you really want to prevent inefficient solutions from passing, enforce it. Add such a large number of random assertions in the Test Cases that even the most efficient solution just completes under
12000 ms
(Codewars code execution time limit). Otherwise, I would suggest simply removing it from the Description.Isn't that 15000 ms now?
It's usually 12s, but have been set longer for certain languages that are slow to boot up (Java and Haskell, I'm looking at you).
duplicate comment
I thought JavaScript as well.
Codewars Forums - Kata Best Practices - Have Full Code Coverage
I haven't actually managed to pass the tests yet (see my other Issue posted below) but every time I run "Attempt", I get the exact same failed output which shows that your tests are not randomly generated at runtime.
Having only 5 fixed assertions in your entire test suite is unacceptable and far from sufficient from preventing logically flawed and/or hardcoded solutions from passing. Please either (1) increase the number of unique, distinct fixed assertions to at least 20 including edge cases or (2) even better, write 100+ random test cases as per standard Codewars practice which is generally preferred over just 20+ fixed tests.
Test.assertEquals
cannot be used to compare two arrays; useTest.assertDeepEquals
instead.Fixed - now at least the Kata is actually completable (I had to forfeit eligibility just to fix the Kata).
BTW @Tova7 not sure how you even managed to publish this Kata in the first place but mind you, your "Complete Solution" was actually buggy and resulted in an infinite loop so I had to replace it with my (working but somewhat inefficient) solution.
You can publish a kata without a working solution. You can't re publish it, but you can publish it. (So to change it, you can unpublish first.) It's a known bug.