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, 15728 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, 15728 Search Bots | 77 Words Subscribe to Feed Burner

Related Articles

  1. Batch Programming in XP
  2. Kaprekar
  3. YES!!
  4. Daily Interview Problem: Circle of Chained Words
  5. Windows Scripting
  6. Daily Interview Problem: Merge K Sorted Linked Lists
  7. Algorithm Interview: No Adjacent Repeating Characters
  8. Daily Interview Problem:Create a balanced binary search tree
  9. Plus One
  10. Staying on a Chess Board

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    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" />