My Blog List

[Leetcode Solution] Single Nubmer 2

Analysis

  • Using XOR method is no more work
  • Count the number of bit occurring at each position to each number in binary form
  • The single number will contain one bit iff the number of bit occurring at that bit cannot divided by 3

Note

  • Extract the bit info of a integer number
  • Form a integer number based on the bit info

Code


No comments:

Post a Comment

Enter you comment