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

Related Articles

  1. Daily Interview Problem: Circle of Chained Words
  2. 56 Bytes
  3. Daily Interview Problem: Deepest Node in a Binary Tree
  4. Sorting a list with 3 unique numbers
  5. Algorithm Interview: Permutations of numbers
  6. Daily Interview Question: Word Search
  7. Algorithm Interview Question: Max and Min with Limited Comparisons
  8. Daily Interview Problem: Largest Product of 3 Elements I
  9. Top K Frequent words
  10. Algorithm Interview: Determine If Linked List is Palindrome

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