Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
21 lines (15 loc) · 389 Bytes

File metadata and controls

21 lines (15 loc) · 389 Bytes
Copy raw file
Download raw file
Edit and raw actions
@author jackzhenguo
@desc 
@date 2019/4/19

77 异位词

两个字符串含有相同字母,但排序不同,简称:互为变位词

from collections import Counter

# 

def anagram(str1, str2):
    return Counter(str1) == Counter(str2)

anagram('eleven+two', 'twelve+one')  # True 这是一对神器的变位词
anagram('eleven', 'twelve')  # False
Morty Proxy This is a proxified and sanitized view of the page, visit original site.