位运算大法好
值得注意 例如0xff 一个f表示15 二进制中表示1111
 
 class Solution {
public:
vector<string> findRepeatedDnaSequences(string s) {
//A is 0101, C is 0103, G is 0107, T is 0124 //3bit to store
unordered_map<int,int> m;
vector<string> r;
int t=,i=,ss=s.length();
while(i<)
t=t<<|s[i++]&;
while(i<ss)
if(m[t=t<<&0x3fffffff|s[i++]&]++==)
r.push_back(s.substr(i-,));
return r;
}
};

leetcode187. Repeated DNA Sequences的更多相关文章

  1. Leetcode187. Repeated DNA Sequences重复的DNA序列

    所有 DNA 由一系列缩写为 A,C,G 和 T 的核苷酸组成,例如:"ACGAATTCCG".在研究 DNA 时,识别 DNA 中的重复序列有时会对研究非常有帮助. 编写一个函数 ...

  2. LeetCode 187. 重复的DNA序列(Repeated DNA Sequences)

    187. 重复的DNA序列 187. Repeated DNA Sequences 题目描述 All DNA is composed of a series of nucleotides abbrev ...

  3. lc面试准备:Repeated DNA Sequences

    1 题目 All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: &quo ...

  4. [Swift]LeetCode187. 重复的DNA序列 | Repeated DNA Sequences

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  5. [LeetCode] Repeated DNA Sequences 求重复的DNA序列

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  6. [Leetcode] Repeated DNA Sequences

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  7. leetcode 187. Repeated DNA Sequences 求重复的DNA串 ---------- java

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  8. 【leetcode】Repeated DNA Sequences(middle)★

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  9. LeetCode() Repeated DNA Sequences 看的非常的过瘾!

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

随机推荐

  1. STL hashtable阅读记录

    unordered_map,unordered_set等相关内容总结: unordered_map和unordered_set是在开发过程中常见的stl数据结构.其本质是hashtable.在SGI_ ...

  2. 343.Integer Break---dp

    题目链接:https://leetcode.com/problems/integer-break/description/ 题目大意:给定一个自然数,将其分解,对其分解的数作乘积,找出最大的乘积结果. ...

  3. 016 sleep,wait,yield,join区别

    1.线程通常有五种状态,创建,就绪,运行.阻塞和死亡状态.2.阻塞的情况又分为三种:(1).等待阻塞:运行的线程执行wait()方法,该线程会释放占用的所有资源,JVM会把该线程放入“等待池”中.进入 ...

  4. ASP.NET Core 2.0 MVC 发布部署--------- CentOS7 X64 具体操作

    .Net Core 部署到 CentOS7 64 位系统中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk-2.0) 3.Supervisor(进程管理工具,目的是 ...

  5. mknod命令

    mknod - make block or character special filesmknod [OPTION]... NAME TYPE [MAJOR MINOR]    option 有用的 ...

  6. Suse Linux下NTP缓慢调整配置,转载至http://www.gpstime.com.cn/

    (1)系统内若有使用crontab 进行与时间调整相关的例行性工作排程,应注释掉(命令人工crontab -e修改,删除定时同步任务ntpdate -s ntpserver). (2)修改ntp配置文 ...

  7. booklist for machine learning

    Recommended Books Here is a list of books which I have read and feel it is worth recommending to fri ...

  8. mongodb卸载再重装

    标题就凸显了尴尬,是的,本地(ubuntu16.04)自带的mongodb太老了,想要装最新版的 卸载: sudo dpkg -P mongodb 然后下载新版的mongodb:  https://m ...

  9. ApplicationContext中getBean详解

    在org.springframework.context包中有一个接口叫 applicationContext applicationContext中有一个getBean方法,此方法继承之BeanFa ...

  10. SCU 4443 Range Query

    二分图最大匹配,枚举. 可以计算出每一个位置可以放哪些数字,每个数字可以放在哪些位置,这样就可以建二分图了. 如果二分图最大匹配不到$n$,则无解.否则构造字典序最小的解,可以枚举每一位放什么数字,然 ...