File: root - text - article - 2019 - 12 - group-words-that-are-anagrams.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 454 Views, 20182 Search Bots | 77 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 454 Views, 20182 Search Bots | 77 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by AirBNB:
Given a list of words, group the words that are anagrams of each other. (An anagram are words made up of the same letters).
Example:
Input: ['abc', 'bcd', 'cba', 'cbd', 'efg']
Output: [['abc', 'cba'], ['bcd', 'cbd'], ['efg']]
Here's a starting point:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 454 Views, 20182 Search Bots | 77 Words Given a list of words, group the words that are anagrams of each other. (An anagram are words made up of the same letters).
Example:
Input: ['abc', 'bcd', 'cba', 'cbd', 'efg']
Output: [['abc', 'cba'], ['bcd', 'cbd'], ['efg']]
Here's a starting point:
import collections
def groupAnagramWords(strs):
# Fill this in.
print groupAnagramWords(['abc', 'bcd', 'cba', 'cbd', 'efg'])
# [['efg'], ['bcd', 'cbd'], ['abc', 'cba']]
Related Articles
- Algorithm Interview: No Adjacent Repeating Characters
- Algorithm Interview: Determine If Linked List is Palindrome
- Fibonacci coding
- Daily Interview Problem: Largest Product of 3 Elements I
- Compare Version Numbers
- Most Frequent Subtree Sum
- Daily Interview Problem: First Missing Positive Integer
- CVE-2015-8874 - cPanel EasyApache Vulnerabilities
- Number of Ways to Climb Stairs
- Daily Interview Problem: Jump to the End
©2006~2024 SteakOverCooked - 0.0101 Seconds(s) - 1833.98 KB/s - 37 Online Memory: 492.18 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !