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.
Sorry for late reply.
Your if statement is wrong. After sorting the array (example) [1,2,3,2,1], it looks like this [1,1, 2, 2, 3]. But your if statement does this:
if ( 1 == 1 && 1 != 2){returns true} (1 == 2 && 1 != 2){returns false} and so on...
You are not tackling the problem correctly.
The fact that the half of the length of the array equals the size of the set, doesn't mean that every number in the set occurs twice.
Any response on this one?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Wrong tests?
Very helpful!!
Ne zameram, s obzirom da mi je prva kata ocekivala sam prepravke. Nisam ocekivala ovako detaljno objasnjenje, hvala ti, nesto sam i naucila! :)
Hey, Johan. The author was unfamiliar with random testing so I tried to add some basic random tests and explain it briefly. Since I edited the kata already I added a test to make sure input array isn't modified and a sentence in description to notify future solvers not to modify input. I think it's better now.
I believe tests are ok now :)
Your random tests are vulnerable to input modification. This can be fixed as simple as
Test.assertEquals(twins(Array.from(arr)), myTwins(arr));
Also, in my unhumble opinion it would be good practice to specify the user solution must not change its input, and check for this.
Hvala Stefane, nadam se da je sada ok? Sta su random testovi? Jos uvek nisam pohvatala sve ovde.
Wrong tests... see my "unfinished solution"...
This comment is hidden because it contains spoiler information about the solution