30 Java String Coding Problems
with Solutions
1. Reverse a String
2. Check if a String is Palindrome
3. Count Occurrences of a Character
4. Find Duplicate Characters in a String
5. Remove Duplicates from a String
6. Check if Two Strings are Anagrams
codingknowledge_
7. Find First Non-Repeated Character harish
8. Check if a String Contains Only Digits
9. Count Vowels and Consonants
10. Check if a String is a Rotation of Another String
11. Find the longest word in a sentence
12. Convert a string to Title Case
13. Find all permutations of a string
14. Convert string to integer without Integer.parseInt()
15. Find the frequency of words in a sentence
16. Convert String to char[] without .toCharArray()
17. Remove all non-alphabetic characters from a string
18. Convert lowercase to uppercase without toUpperCase()
19. Reverse words in a sentence
20. Check if two strings are one edit distance apart
21. Implement strStr() function (Find substring index)
22. Compress a string (aaabb -> a3b2)
23. Find longest common prefix in an array of strings
24. Implement isSubstring() without contains()
25. Print all substrings of a string
26. Convert a number to words (123 -> "One Hundred Twenty-
Three") 27. Validate an email address format
28. Convert CamelCase to snake_case
29. Find the lexicographically smallest string
30. Remove consecutive duplicate words from a sentence
codingknowledge_
harish
1. Reverse a String
2. Check if a String is Palindrome
If you want the complete PDF of this,
then comment "str" 📌
codingknowledge_
harish
3. Count Occurrences of a Character
4. Find Duplicate Characters in a String
5. Remove Duplicates from a String
6. Check if Two Strings are Anagrams
codingknowledge_
harish
7. Find First Non-Repeated Character
8. Check if a String Contains Only Digits
codingknowledge_
harish
codingknowledge_
harish
9. Count Vowels and Consonants
10. Check if a String is a Rotation of Another String
If you want the complete PDF of this,
then comment "str" 📌
11. Find the longest word in a sentence
12. Convert a string to Title Case
codingknowledge_
harish
codingknowledge_
harish
13. Find all permutations of a string
14. Convert string to integer without
Integer.parseInt()
codingknowledge_
harish
15. Find the frequency of words in a sentence
16. Convert String to char[] without
.toCharArray()
codingknowledge_
harish
17. Remove all non-alphabetic characters from a string
18. Convert lowercase to uppercase without
toUpperCase()
codingknowledge_
harish
19. Reverse words in a sentence
If you want the complete PDF of this,
then comment "str" 📌
20. Check if two strings are one edit distance apart
21. Implement strStr() function (Find substring
index)
codingknowledge_
harish
codingknowledge_
harish
22. Compress a string (aaabb -> a3b2)
If you want the complete PDF of this,
then comment "str" 📌
23. Find longest common prefix in an array of strings
24. Implement isSubstring() without contains()
codingknowledge_
harish
codingknowledge_
harish
25. Print all substrings of a string
If you want the complete PDF of this,
then comment "str" 📌
codingknowledge_
harish
26. Convert a number to words (123 -> "One Hundred
Twenty-Three")
If you want the complete PDF of this,
then comment "str" 📌
codingknowledge_
harish
27. Validate an email address format
28. Convert CamelCase to snake_case
If you want the complete PDF of this,
then comment "str" 📌
codingknowledge_
harish
29. Find the lexicographically smallest string
If you want the complete PDF of this,
then comment "str" 📌
codingknowledge_
harish
30. Remove consecutive duplicate words from a
sentence
Happy learning! 🌸
If you want the complete PDF of this,
then comment "str" 📌