What's your answer to this interview question?
One array, excluding one number, all other numbers in the array appear in pair. How to find the position of the number which is not in pair. For example, an array of numbers ……102，102，2，2，44，44，99，23，23，11，11 ……. The number 99 is not in pair. One more question, if the paired numbers are not adjacent to each other, i.e. an array of [102,32,99,32,45,102,45,67,67,100,100], how do you find the position of 99?
Use exclusive or to find the number which is not in pair. Then find the position of the number in the array. The code for finding the number which is not in pair is:
Sorry! You need to login first to post answer.
How to tell HTML from HTML5? Follow below steps: Try it out on Internet Explorer Did it work? No? It's HTML5
- ► What's your opinion about Alibaba mooncake incident?
- ► Should a CTO write code?
- ► What does it feel to have a programmer dad or mom?
- ► Should we be worried about the win of AlphaGo?
- ► Why doesn't IBM file legal brief in support of Apple?
- ► What are the big Internet events in 2015?
- ► Will Elon Musk get into drone business?
- ► What does your work cubicle look like?
- ► What are you most afraid of as a programmer?
- ► Is Apple dead in innovation?