BitMap
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.
Author Houmin Wei
Publish March 31, 2023
LastMod August 27, 2026
License 本作品采用 CC BY-NC-ND 4.0 许可协议进行许可,转载时请注明原文链接
如果你在浏览博客的过程中发现了任何问题,欢迎在对应文章下评论。如果你有其他事情想要咨询,可以通过邮件联系我。
Linked Mentions