[简单题]Consecutive strings
来源:互联网 发布:国外域名 批量 编辑:程序博客网 时间:2024/06/18 12:56
题目链接:
原题链接
这题最难的一点就在于理解题目
题目意思就是找连续的 k 个字符串加起来的总字符串最长的那个,然后返回这个
上代码:
def longest_consec(strarr, k): if len(strarr) == 0 or len(strarr) < k or k <= 0: return '' i = 0 max_len = 0 max_str = '' while i <= len(strarr) - k: b = '' j = 0 while j < k: b += strarr[j + i] j += 1 if len(b) > max_len: max_str = b max_len = len(b) i += 1 return max_str
阅读全文
0 0
- [简单题]Consecutive strings
- Consecutive strings -- 6 kyu
- geeksforgeeks Count number of binary strings without consecutive 1’s
- leetcode 600 Count number of binary strings without consecutive 1
- Hdu 5229 ZCC loves strings(简单题)
- LintCode python 小白-简单题-638-Strings Homomorphism
- poj2406 Power Strings 简单KMP
- binutils 工具: strings 简单分析
- geeksforgeeks Count number of binary strings without consecutive 1′s
- Distinct binary strings of length n with no consecutive 1s
- Power Strings(poj2406 ,简单KMP)
- POJ 2406 Power Strings 简单KMP
- python简单实现linux命令strings
- Strings
- Strings
- strings
- Strings
- Strings
- 【20170929】C语言每日一练
- jdk9新特性
- 国庆阅兵 我们阅代码!全球知名区块链底层技术对比
- 【Angualr4】跨方法计算
- iOS下JS与OC互相调用(二)--WKWebView 拦截URL
- [简单题]Consecutive strings
- HTML网页链接
- iOS下JS与OC互相调用(三)--MessageHandler
- 解决 Android N 上报错:android.os.FileUriExposedException: file:///storage/emulated/0/
- 用户体验的时间尺度
- Java Web学习总结(38)——JavaWeb网站架构设计总结
- redis的回收策略
- mongodb安装文档
- 编写i2c驱动-基于Linux3.10