Locating Restriction Sites
来源:互联网 发布:java常见的接口 编辑:程序博客网 时间:2024/04/29 17:37
对于这道题,测试样例有一个坑,就是它没有类似于’GCGCGC'这种子串,对于’GCGCGC‘这种子串不仅要返回1,6 而且要返回1,4
一旦明白这个问题之后,那么这道题就十分容易解决了,以下是python源码:
dna=input()dna_com=''for i in dna: if i=='A': dna_com+='T' elif i=='C': dna_com+='G' elif i=='G': dna_com+='C' else: dna_com+='A'for i in range(len(dna)-4+1): j=4 while j<=12: if dna[i:i+j]==(dna_com[i:i+j])[::-1]: if i + j < len(dna): print(i + 1, j) else: print(i + 1, len(dna) - i)#当i+j的长度超过原字符串的时候,要注意长度的变化 i+=1 j+=1
阅读全文
0 0
- Locating Restriction Sites
- sites
- Locating Elements
- locating mfc90d.lib
- Locating SIP Services in DNS
- Locating Applications that Have Exits
- Assemblies: locating, binding and deploying
- http://api.showji.com/locating//
- Search Sites
- java sites
- Google Sites
- ebook sites
- mvn2 sites
- web sites
- useful sites
- beautiful sites
- cv sites
- Hadooop sites
- jFinal写的修改密码的具体实现
- 栈的应用 ——计算器
- 串的堆分配存储表示
- Docker 安装 RabbitMQ 集群
- liunx常用命令-01
- Locating Restriction Sites
- strong对象,替换 replace,将字符串1转化为字符串2
- 问题解决:DuplicateKeyException: a different object with the same identifier value
- Leetcode 算法设计 第十四周
- WebService返回XML文件自定义格式
- codeforces 897 A. Scarborough Fair 【暴力】
- 用两栈和两队列实现简易停车场管理系统
- tornado4.5.2HTTP请求及响应流程
- Docker 安装 MongoDB 3.x