题目:我的解法: 1 def checkio(text): 2 import string 3 str = text.encode().lower() 4 adict = {} 5 for i in string.lowercase[::-1]: 6 ...
分类:
其他好文 时间:
2015-04-09 21:34:13
阅读次数:
138
Problem Description
035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,s...
分类:
编程语言 时间:
2015-04-09 15:34:55
阅读次数:
213
题目:
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
思路:
判断两个字符串是否为anagram的方法可以有:
1)将每个字符串的所有字符按字典序排列,比较是否相同。
2)用Has...
分类:
其他好文 时间:
2015-04-08 15:02:39
阅读次数:
143
大小写转换/** * 对关联数组中键名转换大小写处理 * @param [type] $arr 要转换的数组 * @param string $op 必须是CASE_LOWER,CASE_UPPER其中的值,忽略大小写,默认为CASE_LOWER * @return [type] 转...
分类:
其他好文 时间:
2015-04-08 14:37:10
阅读次数:
127
Given a string which contains only letters. Sort it by lower case first and upper case second.NoteIt's not necessary to keep the original order of low...
分类:
其他好文 时间:
2015-04-06 10:04:22
阅读次数:
225
#include #include //必须包含的头文件using namespace std;int main(){int point[10] = {1,3,7,7,9};int tmp = upper_bound(point, point + 5, 7) - point;//按从小到大,7最多能...
分类:
其他好文 时间:
2015-04-05 23:09:37
阅读次数:
195
Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters '
', return the length of last word in the string.
If the last word does not exist, ret...
分类:
其他好文 时间:
2015-04-05 14:39:14
阅读次数:
107
使用两次二分即可得到这个值比如现在有一个vector vec,里面存放的是有序数列。我们现在希望找出范围在[L,R]之间的数有多少个。则有cnt = upper_bound(vec.begin(),vec.end(),r) - lower_bound( vec.begin(),vec.end(),l...
分类:
编程语言 时间:
2015-04-05 00:53:06
阅读次数:
255