This repository contains solutions to various String and Collection-related coding problems. Each problem is implemented in Java and includes examples to demonstrate functionality.
- Reverse a String β Reverse a given string.
- Check if a String is Palindrome β Determine if a string is a palindrome.
- Count Occurrences of a Character β Count how many times a character appears in a string.
- Remove Duplicates from a String β Remove duplicate characters from a string.
- Find First Non-repeated Character β Identify the first character that appears only once.
- Check Anagram β Check if two strings are anagrams.
- Longest Palindromic Substring β Find the longest palindrome substring.
- Check if String Contains Only Digits β Verify if a string consists only of digits.
- Count Words in a String β Count the number of words in a given string.
- String Compression β Compress consecutive duplicate characters (e.g., "aabbbcc" β "a2b3c2").
- Remove All Whitespaces from a String β Remove spaces from a given string.
- Replace All Occurrences of a Character β Replace all occurrences of a character with another.
- Find the Longest Word in a String β Identify the longest word in a sentence.
- Count Vowels and Consonants in a String β Count the vowels and consonants separately.
- Convert a String to a Character Array β Convert a string into an array of characters.
- Reverse Words in a String β Reverse the order of words in a sentence.
- Substring Search β Find the starting index of a substring.
- Remove Substring from a String β Remove a given substring from a string.
- String Equality (Case-insensitive) β Compare two strings without considering case.
- Find the Number of Occurrences of a Substring β Count how many times a substring appears.
- Find the Missing Number in an Array β Identify a missing number from 1 to n.
- Find Duplicate Elements in an Array β Detect duplicates in an array.
- Find the Maximum and Minimum in an Array β Find the highest and lowest values in an array.
- Sort an Array Using
Collections.sort()β Sort a list of integers using JavaβsCollections.sort(). - Merge Two Sorted Lists β Combine two sorted lists into one sorted list.
- Remove Null Elements from a List β Filter out null values.
- Check if a List Contains Duplicates β Detect duplicates using a set.
- Find the Intersection of Two Lists β Find common elements between two lists.
- Reverse a List β Reverse the order of elements in a list.
- Find the Second Largest Element in a List β Identify the second largest number.
- Find All Pairs with Given Sum in an Array β Find pairs whose sum equals a target number.
- Implement Stack Using Two Queues β Simulate a stack using queues.
- Queue Implementation Using Two Stacks β Simulate a queue using stacks.
- ArrayList vs LinkedList β Explain the differences between
ArrayListandLinkedList. - Create a Set from a List β Convert a list into a set (remove duplicates).
- Find Common Elements in Two Arrays β Identify common values in two arrays.
- Find Unique Elements in a List β Identify elements that appear only once.
- Sort a List of Strings by Length β Sort strings based on length.
- Find the Frequency of Each Element in a List β Count occurrences of each element.
- Convert a List to an Array β Convert a list into an array.
- Check if a List is a Sublist of Another List β Determine if one list is a subset of another.
- Remove Elements Divisible by 3 from a List β Remove all numbers divisible by 3.
- Find the Maximum Occurring Element in a List β Identify the most frequent element.
- Sum of Elements in a List β Calculate the total sum of a list.
- Check if a List is Empty β Verify if a list is empty.
- Shuffle a List β Randomly shuffle the elements of a list.
- Find the Union of Two Sets β Combine two sets.
- Find the Difference Between Two Sets β Identify elements in one set but not in another.
- Implement a Priority Queue β Create a priority queue.
- Count Elements Greater than a Given Value β Count how many numbers are greater than a specific value.
- Clone the repository
git clone https://github.com/amitkumar-kellton/Java_Assignment.git