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.
Double check the description and make improvements. Here's a recommended description:
Task
Write a function that takes an array of integers whose length is odd ( ≥ 3 ).
Every element in the array has the same value except for one unique element.
Return that unique element.
Guarantees
• The array length is odd.
• Exactly one element differs from the others.
• All values are integers.
Examples
[1, 1, 2] => 2
[17, 17, 3, 17, 17, 17, 17] => 3
Clarification
If the array is [4, 4, 4, 9, 4], the function should return 9, because 9 is the only value that is not equal to 4.
Haskell translation
Certain incorrect solutions can pass if you try the tests repeatedly (at least in Python - have not tested other languages).
The full definition of the
TreeNode
should be inpreloaded
, not in the user solution. This affects all languages except Python.C++: No random tests
TypeScript translation (literal translation of JavaScript; author inactive)
This comment is hidden because it contains spoiler information about the solution
Language: C++
Test suit missing the required header
std::vector
Add some almost sorted fixed tests like
[1, 3, 9, 4]
to invalidate wrong solutions currently passing tests by chance.Scala translation
Tests seem to be broken.
I keep getting expected [ undefined ] to deeply equal [ 1, 2, 3, 7, 16, 17 ] even though I am returning the array in the correct order
This comment is hidden because it contains spoiler information about the solution
Go translation
D translation
This is hardly understandable, misleading and should be reworded. The predicate doesn't applicate to the elements of the list but to their respective
.data
field.Loading more items...