gati.sahu
BAN USERpublic List<List<String>> groupAnagrams(String[] strs) {
List<List<String>> resultList = new ArrayList<>();
Map<String, List<String>> map = new HashMap<>();
for (String str : strs) {
char[] chArray = str.toCharArray();
Arrays.sort(chArray);
String tempString = String.valueOf(chArray);
if (!map.containsKey(tempString)) {
List<String> newList = new ArrayList<>();
map.put(tempString, newList);
}
map.get(tempString).add(str);
}
for(String key:map.keySet()){
resultList.add(map.get(key));
}
return resultList;
}
- gati.sahu May 11, 2017
Reprichardcstrong, Accountant at AppPerfect
I am a modern magician, except I transform complicated technical ideas into user-friendly images before the eyes of your company ...
Repallisonepollard, Applications Developer at Accenture
I am Allison from Germantown. I work as a Staff manager at The LawnGuru company. But my interest in blogging ...
it will print 0-99.
- gati.sahu May 13, 2017if we will loop using int it will print 99.