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!! πͺ
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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
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!! πͺ