0% found this document useful (0 votes)
5 views

30 Java Coding problems

The document lists 30 Java string coding problems along with their solutions, covering a variety of tasks such as reversing strings, checking for palindromes, and counting character occurrences. It includes challenges like finding duplicates, validating email formats, and converting strings to different cases. The document serves as a resource for practicing Java string manipulation skills.

Uploaded by

ishivamkunal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

30 Java Coding problems

The document lists 30 Java string coding problems along with their solutions, covering a variety of tasks such as reversing strings, checking for palindromes, and counting character occurrences. It includes challenges like finding duplicates, validating email formats, and converting strings to different cases. The document serves as a resource for practicing Java string manipulation skills.

Uploaded by

ishivamkunal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

‭https://www.linkedin.

com/in/anshulagarwal30‬

‭30 Java String Coding Problems with Solutions‬


‭30 Java String Coding Problems with Solutions‬
‭1. Reverse a String‬
‭2. Check if a String is Palindrome‬


‭3. Count Occurrences of a Character‬

al
‭4. Find Duplicate Characters in a String‬
‭5. Remove Duplicates from a String‬
‭6. Check if Two Strings are Anagrams‬
‭7. Find First Non-Repeated Character‬

rw
‭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‬

ga ‭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‬
lA
‭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‬
hu

‭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‬
ns

‭29. Find the lexicographically smallest string‬


‭30. Remove consecutive duplicate words from a sentence‬
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭1. Reverse a String‬


al
rw
ga
‭2. Check if a String is Palindrome‬
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭3. Count Occurrences of a Character‬


al
rw
ga
‭4. Find Duplicate Characters in a String‬
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭5. Remove Duplicates from a String‬


al
rw
ga
‭6. Check if Two Strings are Anagrams‬
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭7. Find First Non-Repeated Character‬


al
rw
ga
lA
hu

‭8. Check if a String Contains Only Digits‬


ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭9. Count Vowels and Consonants‬


al
rw
ga
lA
‭10. Check if a String is a Rotation of Another String‬
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭11. Find the longest word in a sentence‬


al
rw
ga
lA
‭12. Convert a string to Title Case‬
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭13. Find all permutations of a string‬


al
rw
ga
lA
hu

‭ 4. Convert string to integer without‬


1
Integer.parseInt()‬

ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭15. Find the frequency of words in a sentence‬


al
rw
ga
lA

String‬‭to‬‭
‭16. Convert‬‭ char[]‬‭without‬
.toCharArray()‬

hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭17. Remove all non-alphabetic characters from a string‬


al
rw
ga
lA
‭ 8. Convert lowercase to uppercase without‬
1
toUpperCase()‬

hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭19. Reverse words in a sentence‬


al
rw
ga
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭20. Check if two strings are one edit distance apart‬


al
rw
ga
lA
hu

strStr()‬‭function (Find substring‬


‭ 1. Implement‬‭
2
ns

‭index)‬
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭22. Compress a string (aaabb -> a3b2)‬


al
rw
ga
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭23. Find longest common prefix in an array of strings‬


al
rw
ga
lA
hu

isSubstring()‬‭without‬‭
‭24. Implement‬‭ contains()‬
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭25. Print all substrings of a string‬


al
rw
ga
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭ 6. Convert a number to words (123 -> "One Hundred‬


2
‭Twenty-Three")‬


al
rw
ga
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭27. Validate an email address format‬


al
rw
ga
‭28. Convert CamelCase to snake_case‬
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭29. Find the lexicographically smallest string‬


al
rw
ga
lA
hu
ns
‭A
‭https://www.linkedin.com/in/anshulagarwal30‬

‭ 0. Remove consecutive duplicate words from a‬


3
‭sentence‬


al
rw
ga
lA
hu

‭Happy learning! 🌸‬
ns
‭A

You might also like