[LintCode]Anagrams(Python)
来源:互联网 发布:米惠淘宝返利网 编辑:程序博客网 时间:2024/05/17 08:09
class Solution: # @param strs: A list of strings # @return: A list of strings def anagrams(self, strs): # write your code here ret = [] strs_reag = [] strs_uni = [] for str in strs: strs_reag.append(sorted(str)) for str in strs_reag: if strs_reag.count(str) > 1 and str not in strs_uni: strs_uni.append(str) for str in strs_uni: for i in range(len(strs)): if str == strs_reag[i]: ret.append(strs[i]) return ret
阅读全文
0 0
- [LintCode]Anagrams(Python)
- [LintCode]Two Strings Are Anagrams(C++|Java|Python)
- lintcode(647)Substring Anagrams
- LintCode 647 Substring Anagrams
- Two Strings Are Anagrams-LintCode
- lintcode(round1)Substring Anagrams
- Anagrams by Stack python
- 【Leetcode】【python】Group Anagrams
- [python]leetcode(49). Group Anagrams
- LeetCode--Group Anagrams(Python)
- LintCode Two Strings Are Anagrams 两个字符串是变位词
- 「LintCode」java字符串練習四──anagrams
- Anagrams
- Anagrams
- Anagrams
- Anagrams
- Anagrams
- Anagrams
- (4)document:getElementById、getElementByName、getNodeByTagName
- [LintCode]strStr(C++)
- uva 400 Unix ls 127页
- stl容器
- HashMap重要知识点总结
- [LintCode]Anagrams(Python)
- 朴素贝叶斯原理及实现
- 关于一个图中是否存在负环
- python-pandas的基本用法03
- uva 136 120页
- JS利用apply方法,将数组直接当做参数传给函数
- Linux 磁盘加密
- 练习2-3 编写函数 htoi(s),把由十六进制数字组成的字符串(包含可选的前缀0x或0X)转换为与之等价的整型值。字符串中允许包含的数字包括:0~9、a~f以及A~F。
- Curling 2.0