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

Related Articles

  1. Daily Interview Problem: Find the Number of Islands
  2. Daily Interview Problem: Full Binary Tree
  3. Daily Interview Puzzle: Minimum Size Subarray Sum
  4. Spectrum Master
  5. Consecutive Ones
  6. Daily Interview Problem: Word Ordering in a Different Alphabetical Order
  7. Absolute Path
  8. Algorithm Interview: Longest Consecutive Sequence
  9. Algorithm Interview Question: H-Index
  10. Algorithm Interview: Subarray With Target Sum

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="index, follow">