DEV Community

Discussion on: #22 - Find the unique number CodeWars Kata (6 kyu)

Collapse
 
cesar__dlr profile image
Cesar Del rio

Thanks for the comment bro πŸ”₯, I understand what you want to do, you'll check every item and then check the element next to it and the element behind it so you know if they're equal, but when you test it, remember that the problem gives you an array with only 2 numbers (the repeated one and the unique one), you are testing it with a lot of different numbers, so it returns the first number that is different to the 2 next to it

111, -1 , -2

I don't know if this would work with the last element of the array, because index+1 doesn't exist, or with the first one because the element index-1 doesn't exist.

Either way I think it's a great solution, you just need to adapt it a little bit more to the problem πŸ™Œ

Keep going!! πŸ’ͺ