Correct me if I misunderstood, but the question is to find the first integer that appears an odd number of times. Wouldn't this solution not work if there are multiple integers appearing an odd number of times?
For instance, findOddInt([1,1,2,2,2,3,3,3]) would return 1 instead of the expected value of 2.
But even this I still think the problem is somewhat unclear; Should findOddInt([1,2,2,2,1,1]) return '1' because '1' appeared initially before '2', or should it be '2' because it was the first to appear an odd number of times?
I'm currently 🌱 learning and 🔭 working on the Javascript Ecosystem.
😄 Pronouns: she/her
⚡ Fun fact: I have a Computer Engineering background but the most credit goes to Google and Stack Overflow
Correct me if I misunderstood, but the question is to find the first integer that appears an odd number of times. Wouldn't this solution not work if there are multiple integers appearing an odd number of times?
For instance, findOddInt([1,1,2,2,2,3,3,3]) would return 1 instead of the expected value of 2.
The solution I came up with is:
But even this I still think the problem is somewhat unclear; Should findOddInt([1,2,2,2,1,1]) return '1' because '1' appeared initially before '2', or should it be '2' because it was the first to appear an odd number of times?
Very well done! The question should be changed to only one integer occurs odd number of times