136 Single Number

  • XOR.

137 Single Number II

  • In such a problem, use bit DFA to substitude XOR operation. Such bit DFA should become 0 if 1 is met M times, where M is the occurence time of most elements.

187 Repeated DNA Sequences

  • Given a DNA sequence (ATCG), find all 10-length substring occuring more than once.
  • Use bitset to accelerate.

201 Bitwise AND of Numbers Range

  • Find the most significant bit that two numbers differ.

260 Single Number III

  • Given an array, all elements appear twice except two elements appear once. Find the two numbers.
  • O(n) time and O(1) space. The two numbers must differ in some bit. Divice the whole array according to the bit, and the subproblem is Single Number I.

318 Maximum Product of Word Lengths

  • Given a list of words, find maximum length product of two words having no common characters.
  • O(n^2) time, use bit manipulation for acceleration.

393 UTF-8 Validation

  • Emulation using bit manipulation.