Java Coding Problems for Placement
Practice
These problems are categorized into Easy and Medium levels to help you prepare for coding
rounds in TCS, Cognizant, Accenture, etc.
🔹 Easy Level (Basics)
1. 1. Reverse a number
2. 2. Check if a string is a palindrome
3. 3. Count vowels and consonants in a string
4. 4. Find maximum and minimum in an array
5. 5. Sum of all elements in an array
6. 6. Linear Search in an array
7. 7. Binary Search in a sorted array
8. 8. Bubble Sort implementation
9. 9. Print Fibonacci series up to N terms
10. 10. Factorial of a number using recursion
🔹 Medium Level (DSA Oriented)
11. 11. Reverse words in a sentence
12. 12. Frequency of characters in a string using HashMap
13. 13. Find duplicates in an array
14. 14. Two Sum problem (return indices)
15. 15. Longest common prefix among strings
16. 16. Remove duplicates from a sorted array
17. 17. Implement Stack using an array
18. 18. Check for valid parentheses using Stack
19. 19. Check if two strings are anagrams using HashMap
20. 20. Subarray with given sum using sliding window