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 | 455 Views, 20225 Search Bots | 77 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 455 Views, 20225 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 | 455 Views, 20225 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
- Spectrum Master
- Algorithm Interview: Smallest Number that is not a Sum of a Subset of List
- [Daily Problem] Add two numbers as a linked list
- Windows Scripting
- Design Tic-Tac-Toe
- Algorithm Interview Question: Nth Fibonacci Number
- Daily Interview Problem: Merge List Of Number Into Ranges
- Kaprekar
- Algorithm Interview: Subarray With Target Sum
- Number of Ways to Climb Stairs
©2006~2024 SteakOverCooked - 0.00939 Seconds(s) - 1991.197 KB/s - 52 Online Memory: 492.33 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 !