100 MUST-DO Practice Problems (Java + Java 8 +
SQL)
Target: Accenture | IBM | PwC | CGI | Service + Product Companies
Part 1: Core Java Coding Problems (1–40)
1 Reverse a string without using built-in reverse
2 Check palindrome string/number
3 Find duplicate characters in a string
4 First non-repeating character in string
5 Count frequency of characters using HashMap
6 Check if two strings are anagrams
7 Find missing number in array
8 Find second largest element in array
9 Sort array without using sort()
10 Remove duplicates from array
11 Find all pairs with given sum
12 Find common elements between two arrays
13 Rotate array left/right
14 Check if array is sorted
15 Find max/min without using Collections
16 Swap two numbers without temp variable
17 Fibonacci series using iteration
18 Factorial using recursion
19 Check prime number
20 Count vowels and consonants
21 Reverse each word in sentence
22 Find longest word in string
23 Find duplicate elements in list
24 Convert List to Set and vice versa
25 Difference between HashMap and Hashtable (with example)
26 Fail-fast vs fail-safe iterator example
27 Immutable class creation
28 Custom equals() and hashCode()
29 Singleton class (thread-safe)
30 String vs StringBuilder performance test
31 Deadlock example
32 Producer Consumer using wait/notify
33 Multithreading using Runnable
34 Callable vs Runnable example
35 Count words in file
36 Read file and find max occurring word
37 Reverse LinkedList
38 Detect loop in LinkedList
39 Binary search implementation
40 Linear search implementation
Part 2: Java 8 (Streams & Lambdas) Problems (41–70)
1 Filter even numbers using streams
2 Find max/min using streams
3 Find duplicate elements using streams
4 Sort list using streams
5 Convert list to map
6 Group strings by length
7 Count frequency of characters using streams
8 Find first non-repeating character using streams
9 Sum of all numbers using reduce()
10 Find second highest number
11 Remove duplicates using distinct()
12 Partition numbers into even/odd
13 Find longest string in list
14 Sort map by values
15 FlatMap example
16 Difference between map() and flatMap()
17 Optional usage example
18 Stream vs Collection
19 Parallel stream example
20 Custom functional interface example
21 Predicate vs Function vs Consumer
22 Method reference example
23 [Link] example
24 [Link] example
25 Lazy evaluation in streams
26 Limit and skip usage
27 Find common elements between two lists using streams
28 Stream short-circuit operations
29 Exception handling in streams
30 Convert array to stream
Part 3: SQL Interview Problems (71–100)
1 Find second highest salary
2 Find nth highest salary
3 Employees earning more than manager
4 Duplicate records in table
5 Delete duplicate records
6 Difference between WHERE and HAVING
7 INNER vs LEFT vs RIGHT JOIN
8 Find departments with no employees
9 Top 3 salaries per department
10 Count employees per department
11 Find employees joined in last 30 days
12 Find highest salary department-wise
13 Self join example
14 Find records present in table A not in B
15 Second lowest salary
16 Find employee with max salary
17 Group by with having example
18 Index usage and benefits
19 Clustered vs non-clustered index
20 Normalize a table (1NF–3NF)
21 Find duplicate emails
22 Swap gender values in table
23 Fetch odd/even records
24 Delete records based on condition
25 Difference between DELETE, TRUNCATE, DROP
26 Find total salary paid per department
27 Find employee count by location
28 Window function example
29 Rank vs Dense_Rank
30 Case when usage