public void sortAnagrams3(String[] arr) {
		HashMap<String, LinkedList<String>> hm = new HashMap<>();
		for (String s : arr) {
			String key = sortString(s);
			if (!hm.containsKey(key)) {
				hm.put(key, new LinkedList<String>());
			}
			LinkedList<String> anagrams = hm.get(key);
			anagrams.push(s);
		}

		//O(n^2)
		int index = 0;
		for (String key : hm.keySet()) {
			LinkedList<String> list = hm.get(key);
			for (String str : list) {
				arr[index] = str;
				index++;
			}
		}
	}