Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 419 Bytes

File metadata and controls

32 lines (20 loc) · 419 Bytes

Leetcode

Given an array of strings, group anagrams together.

Example:

Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Note:

All inputs will be in lowercase. The order of your output does not matter.

Solution

https://leetcode-cn.com/problems/group-anagrams/solution/

方法

  1. 建立一个排序之后的string为key的map