0% found this document useful (0 votes)
42 views3 pages

Palindrome Problems

The document outlines various string-related problems and challenges, categorized into sections such as palindrome problems, substring and subsequence problems, anagram and permutation problems, pattern matching, transformations, frequency and count problems, string compression and decompression, advanced problems, and coding challenges. Each section includes specific tasks such as checking for palindromes, finding common substrings, and implementing algorithms like KMP. Additionally, it provides tips for practice to enhance problem-solving skills.

Uploaded by

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

Palindrome Problems

The document outlines various string-related problems and challenges, categorized into sections such as palindrome problems, substring and subsequence problems, anagram and permutation problems, pattern matching, transformations, frequency and count problems, string compression and decompression, advanced problems, and coding challenges. Each section includes specific tasks such as checking for palindromes, finding common substrings, and implementing algorithms like KMP. Additionally, it provides tips for practice to enhance problem-solving skills.

Uploaded by

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

1.

Palindrome Problems
Check if a string is a palindrome:
Write a function to check if a given string reads the same forward and backward.

Longest Palindromic Substring:


Find the longest substring of a given string that is a palindrome.

Count Palindromic Substrings:


Count all substrings of a string that are palindromes.

Remove Palindromic Subsequences:


Given a string, find the minimum number of steps to make it empty by removing
palindromic subsequences.

2. Substring and Subsequence Problems


Find all substrings of a string:
Generate all possible substrings of a string.

Find all subsequences of a string:


Generate all possible subsequences of a string using recursion.

Longest Common Substring:


Find the longest substring that is common between two given strings.

Longest Common Subsequence:


Find the longest subsequence common between two strings (does not need to be
contiguous).

3. Anagram and Permutation Problems


Check if two strings are anagrams:
Determine if two strings are made of the same characters with the same frequency.

Group anagrams:
Given a list of strings, group them into groups of anagrams.

Find all permutations of a string:


Generate all permutations of a given string.

Smallest window with all characters of another string:


Find the smallest substring in str1 that contains all characters of str2.

4. Pattern Matching
Check if a string contains another string:
Implement a function to check if one string is a substring of another.

KMP Algorithm for Pattern Matching:


Learn and implement the Knuth-Morris-Pratt (KMP) algorithm to search for patterns
in a string.

Z Algorithm for Pattern Matching:


Implement the Z-algorithm to find all occurrences of a pattern in a string.

Wildcard Matching:
Given a string and a pattern (with * and ?), determine if they match.

5. Transformations
Reverse words in a string:
Reverse the order of words in a sentence while keeping the words intact.
Remove vowels from a string:
Write a function to remove all vowels from a given string.

Remove duplicate characters:


Remove duplicate characters in a string while maintaining the order.

Convert string to integer:


Implement your own atoi function to convert a string to an integer.

6. Frequency and Count Problems


Count character frequencies:
Count the frequency of each character in a string.

Find the first non-repeating character:


Return the first character that does not repeat in a string.

Character with the maximum frequency:


Find the character that appears most frequently in a string.

Check if two strings are rotations of each other:


Determine if one string is a rotation of another.

7. String Compression and Decompression


Basic string compression:
Compress a string using the counts of repeated characters (e.g., "aaabb" → "a3b2").

Run-length encoding:
Encode a string using run-length encoding (e.g., "aaaabbcc" → "4a2b2c").

Decode a compressed string:


Given a compressed string like "3[a2[b]]", decode it into "abbabbabb".

8. Advanced Problems
Check if a string is a valid shuffle:
Given three strings, check if one is a valid shuffle of the other two.

Edit Distance:
Find the minimum number of operations (insert, delete, replace) to convert one
string to another.

Count distinct substrings:


Count the number of distinct substrings in a string.

Print all palindromic partitions:


Partition a string into all possible palindromic substrings.

9. Coding Challenges
Valid Parentheses:
Check if a string of parentheses ("()[]{}") is valid.

Reorganize String:
Rearrange characters in a string so that no two adjacent characters are the same.

Longest Repeating Substring:


Find the longest repeating substring in a string.

Implement strstr():
Write a function to find the first occurrence of a substring in another string.
Tips for Practice
Start Simple: Begin with basic problems (e.g., reversing a string) to build
confidence.
Use Built-in Functions Sparingly: Try to solve problems without relying on library
functions for deeper understanding.
Write Test Cases: Test your solution on edge cases (e.g., empty string, single
character).
Optimize: After solving, revisit your solution to improve its efficiency.

You might also like