Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I get it now. Thank you!
The "[100, 150, 350, 400] should equal [100, 200, 300, 400]" means that you solution returned
[100, 150, 350, 400]
, while the answer expected by tests is[100, 200, 300, 400]
. It does not say anything about whether the test case is valid or not, because we do not know what was the input of the test case. All we know is that the answer returned by your solution has two incorrect elements.Hello,
I noticed that some of the test cases in the task seem to be incorrect based on the problem description. Specifically:
[100, 150, 350, 400] should equal [100, 200, 300, 400] – however, this sequence has two incorrect elements, which contradicts the task's rule that only one element can be incorrect.
[200, 250, 300, 350] should equal [100, 200, 300, 400] – this seems to be an issue where the sequence is correct, but the test case expects it to be fixed, which isn't in line with the problem's requirements.
Test case 88 failed: [2, 10, 12, 17] => [2, 10, 18, 26], expected [2, 7, 12, 17] – the difference in the sequence is not consistent with the expected progression.
These tests seem to contradict the condition that only one element in the sequence can be corrupted. I believe these test cases need to be corrected to ensure they align with the problem statement.
Thank you!
Thank you! I see now what I was missing... 🤦♂️
I believe you are seeing only the output results. That is, [100, 250, 400, 550] is not the input you were given. Rather, it's saying that your function returned [100, 250, 400, 550] when it should have returned [100, 200, 300, 400].
If you are having trouble figuring out why this is happening, you can try printing the test inputs on your attempts in order to see what was passed into your function. So, depending on the language you are using, you can add something like
console.log(sequence)
orprint(sequence)
as the first line of your function and that will show you exactly what your function is being passed on each iteration. This should help you nail down the problem and modify your function accordingly.Apologies if I am being stupid...
Why is this so when the difference between each int is already 150?
(Marked as having spoiler content to be safe)
For Python, at least, you need more random cases for
length == 4
.This solution
cannot handle such case, but still passes the random tests, given enough tries.
This comment is hidden because it contains spoiler information about the solution
Java: There are no tests with 4 elements.
Random tests increased to 100 and sequences with 4 elements are generated in random tests as well.
Thanks for the feedback. I have fixed the issues you have pointed out. Please do not hesitate to point out any other issues.
Hi,
The tests shouldn't be written in a class. See the docs about authoring python kata.
The case with
len(seq)==3
is not discussed in the description. Is it tested ?This sentence is misleading:
Strictly speaking, it's incorrect: there are no swaps at all, it's only one single value that is not following the pattern. Talking about swap implies 2 values would be wrong, which is not the case.
cheers
isn't that a duplicate? (I'm pretty sure it is...)
length
is3
, the problem is ambiguous ([0, 3, 4]
could lead to[0, 2, 4]
,[2, 3, 4]
or[0, 3, 6]
Loading more items...