To the Top
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 | 167 Views, 15634 Search Bots | 77 Words

Subscribe to Feed Burner | 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:


import collections

def groupAnagramWords(strs):
# Fill this in.

print groupAnagramWords(['abc', 'bcd', 'cba', 'cbd', 'efg'])
# [['efg'], ['bcd', 'cbd'], ['abc', 'cba']]
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 167 Views, 15634 Search Bots | 77 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Question: Find Cycles in a Graph
  2. Skip the readings, focus on problems. And use all the hints!
  3. Generate All IP Addresses
  4. Spectrum Master
  5. Find Missing Numbers in an Array
  6. Daily Interview Problem: Longest Substring With K Distinct Characters
  7. Daily Interview Problem: Distribute Bonuses
  8. Delphi Dynamic Array
  9. Kaprekar
  10. Daily Interview Question: Word Search

Comments (0)

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />