public ArrayList<String> anagrams(String[] strs) {
		// Note: The Solution object is instantiated only once and is reused by
		// each test case.

		ArrayList<String> result = new ArrayList<String>();
		HashMap<String, ArrayList<Integer>> recordMap = new HashMap<String, ArrayList<Integer>>();
		for (int i = 0; i < strs.length; ++i){
			char [] chars = strs[i].toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			if (!recordMap.containsKey(sortedStr)){
				recordMap.put(sortedStr, new ArrayList<Integer>());
				recordMap.get(sortedStr).add(i);
			}else{
				recordMap.get(sortedStr).add(i);
			}
		}

		for(String str : recordMap.keySet()){
			if(recordMap.get(str).size() > 1){
				for(Integer idx : recordMap.get(str)){
					result.add(strs[idx]);
				}
			}
		}

		return result;
	}