Finding index of array of 2nd occurring element

I’m not writing the code for you but here’s the gist: Create a variable that tells whether or not you’ve seen your number before. Go through your array and the first time you see it set that variable to remember that you’ve seen it. The next time you see it check the variable you created to make sure you’ve seen it before and then you will have proven that you’ve seen it twice. At that moment copy the index.

Leave a Comment