Stream API coding question
1. How do you group employees by city and count the number of employees in each city?
2. How do you group employees by city and get the list of employees for each city?
3. How do you group employees by city but only keep selected fields (like name and
department)?
4. How do you convert a list of employees into a map with employee ID as the key and
employee object as the value?
5. What happens if there are duplicate keys when using [Link]? How do you
resolve it?
6. How would you use [Link] to convert a list of employees into a map by ID
while handling duplicate keys by updating the existing value?
7. How do you find the employee with the maximum salary using streams?
8. How do you find the employee with the minimum salary using streams?
9. How do you find the Nth highest paid employee?
10.How do you find the Nth lowest-paid employee?
11.Show the employee's max salary, or the 2nd max, or the nth maximum
department-wise?
12.Find the employee with the maximum salary department-wise.
13.Find the employee with the minimum salary department-wise.
14.Find the employee with the second-highest salary department-wise.
15.Find the employee with the second-lowest salary department-wise.
String Question
1. Count the frequency of the character
2. Count the frequency of the character and print only the duplicate value
3. remove all the duplicate characters from the string (using a linked hash set or a Boolean
array)
4. Find the first non-repeating character
5. Count the frequency of the word
6. Count the frequency of the word and print only the duplicate value
7. Remove all the duplicate words from the string
8. Give a string of numbers and convert it to an integer without using an [Link]()
9. Reverse a string
10.Reverse each word in the string
11.Is string a palindrome
12.Given a string s1 and s2, which is your target string, count the no of times s2 is present
in s1
13.Length of the longest substring without repeating characters