Thoughtworks Interview Question

Frequency of characters in a string. (Short coding problem)

Interview Answers

Anonymous

Mar 25, 2025

String s = "Thoughtworks"; Map freqMap = s.chars().mapToObj(ch -> (char) ch).collect(Collectors.groupingBy(Function::identity , LinkedHashMap::new , Collectors.counting()));

Anonymous

Mar 25, 2025

String s = "Thoughtworks"; Map freqMap = s.chars().mapToObj(ch -> (char) ch).collect(Collectors.groupingBy(Function::identity , LinkedHashMap::new , Collectors.counting()));