is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
public class GroupWordsUniqueCharacters {
- Diamond March 14, 2017public static Comparator<String> ascendingStringComparator= new Comparator<String>(){
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
};
private String rootWord(String str)
{
Set<Character> sortedCharacters = new TreeSet<>();
for(int i=0;i<str.length();i++)
sortedCharacters.add(str.charAt(i));
StringBuilder buffer= new StringBuilder();
for(Character c:sortedCharacters){
buffer.append(c);
}
return buffer.toString();
}
public Map<String,List<String>> groupWords(String [] words){
Map<String,List<String>> resultMap= new TreeMap<>(); //sorted Map
for(String word:words){
String uniqueString=rootWord(word.toLowerCase());
if(resultMap.containsKey(uniqueString)){
resultMap.get(uniqueString).add(word);
}else{
List<String> similarWords= new ArrayList<>();
similarWords.add(word);
resultMap.put(uniqueString,similarWords);
}
}
return resultMap;
}
public static void main(String args[]){
GroupWordsUniqueCharacters grpWdUniqueChar = new GroupWordsUniqueCharacters();
String [] words={"May", "student", "students", "dog", "studentssess",
"god", "Cat", "act", "tab", "bat", "flow", "wolf", "lambs",
"Amy", "Yam", "balms", "looped", "poodle", "john", "alice" };
Map<String,List<String>> groupWordsMap=grpWdUniqueChar.groupWords(words);
for(Map.Entry<String, List<String>> orderMap:groupWordsMap.entrySet()){
List<String> row=orderMap.getValue();
Collections.sort(row,ascendingStringComparator);
if(row.size()>1){// single word
for(String word:row){
System.out.print(word);
System.out.print(" ");
}
System.out.println("");
}
}
}
}