乱序字符串_LintCode

给出一个字符串数组S,找到其中所有的乱序字符串(Anagram)。如果一个字符串是乱序字符串,那么他存在一个字母集合相同,但顺序不同的字符串也在S中。


样例

对于字符串数组 ["lint","intl","inlt","code"]

返回 ["lint","inlt","intl"]

注意

所有的字符串都只包含小写字母


public class Solution {
    /**
     * @param strs: A list of strings
     * @return: A list of strings
     */
    public List anagrams(String[] strs) {
        // write your code here
        List list = new LinkedList();
		Map map = new HashMap<>();
		String[] s_ = new String[strs.length]; 
		for(int i=0;i 1)
				list.add(strs[i]);
			else
				continue;
		}
		return list;
    }
}


你可能感兴趣的:(刷题相关)