String Data Structure

‘Recent Articles’ on Strings

Topics :

Basics :



Strings in C & C++ :

Strings in Java :

Strings in Python :

  1. String Methods in Python : Set 1 , Set 2 , Set 3
  2. Dictionary and counter in Python to find winner of election
  3. Maximum length of consecutive 1’s in a binary string in Python using Map function
  4. Python code to print common characters of two Strings in alphabetical order
  5. Using Counter() in Python to find minimum character removal to make two strings anagram
  6. Reverse string in Python
  7. Python groupby method to remove all consecutive duplicates
  8. Generate two output strings depending upon occurrence of character in input string in Python
  9. Python Dictionary to find mirror characters in a string
  10. Python | Convert a list of characters into a string
  11. Map function and Lambda expression in Python to replace characters
  12. Zip function in Python to change to a new character set
  13. SequenceMatcher in Python for Longest Common Substring
  14. Python | Print the initials of a name with last name in full
  15. Python counter and dictionary intersection example (Make a string using deletion and rearrangement)
  16. Python program to count number of vowels using sets in given string
  17. Python set to check if string is panagram
  18. Python | Check if a Substring is Present in a Given String
  19. Python sorted() to check if two strings are anagram or not
  20. Python | Remove leading zeros from an IP address
  21. Python | Count all prefixes in given string with greatest frequency
  22. Check if both halves of the string have same set of characters in Python
  23. Concatenated string with uncommon characters in Python
  24. Second most repeated word in a sequence in Python
  25. Regex in Python to put spaces between words starting with capital letters
  26. Python code to move spaces to front of string in single traversal
  27. String slicing in Python to rotate a string
  28. String slicing in Python to check if a string can become empty by recursive deletion
  29. Reverse words in a given String in Python
  30. Run Length Encoding in Python
  31. Anagram checking in Python using collections.Counter()
  32. Remove all duplicates from a given string in Python
  33. Remove all consecutive duplicates from the string
  34. Python program to check if a string is palindrome or not

Arthimetic Operation in String :

Character Counting Based Problems :

  1. Count Uppercase, Lowercase, special character and numeric values
  2. Find the smallest window in a string containing all characters of another string
  3. Smallest window that contains all characters of string itself
  4. Count number of substrings with exactly k distinct characters
  5. Number of substrings with count of each character as k
  6. String with k distinct characters and no same characters adjacent
  7. Number of substrings of a string
  8. Distinct strings with odd and even changes allowed
  9. Find k’th character of decrypted string
  10. Count characters at same position as in English alphabets
  11. Count words in a given string
  12. Count words present in a string
  13. Count of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given word
  14. Program to find Smallest and Largest Word in a String
  15. Count substrings with same first and last characters
  16. Recursive solution to count substrings with same first and last characters
  17. Count of distinct substrings of a string using Suffix Array
  18. Count of distinct substrings of a string using Suffix Trie
  19. Count number of strings (made of R, G and B) using given combination
  20. Count of strings that can be formed using a, b and c under given constraints
  21. Count of substrings of a binary string containing K ones
  22. Group words with same set of characters
  23. Print all distinct characters of a string in order (3 Methods)
  24. Print common characters of two Strings in alphabetical order
  25. Common characters in n strings
  26. Find uncommon characters of the two strings
  27. Concatenated string with uncommon characters of two strings
  28. Program to remove vowels from a String
  29. Remove consecutive vowels from string
  30. Program to count vowels in a string (Iterative and Recursive)
  31. Count consonants in a string (Iterative and recursive methods)
  32. Alternate vowel and consonant string
  33. Given a binary string, count number of substrings that start and end with 1
  34. Number of distinct permutation a String can have
  35. Time complexity of all permutations of a string
  36. Permutations of a given string using STL
  37. Check if both halves of the string have same set of characters
  38. Count words that appear exactly two times in an array of words
  39. Check if frequency of all characters can become same by one removal
  40. Check if a string has all characters with same frequency with one variation allowed
  41. Count ways to increase LCS length of two strings by one
  42. Find the character in first string that is present at minimum index in second string
  43. Remove characters from the first string which are present in the second string
  44. Length of Longest sub-string that can be removed
  45. Count of character pairs at same distance as in English alphabets
  46. Count number of equal pairs in a string
  47. Count of strings where adjacent characters are of difference one
  48. Print number of words, vowels and frequency of each character


Subsequence & Substring :

Reverse & Rotation :

  1. Perfect reversible string
  2. Reversing an Equation
  3. Left Rotation and Right Rotation of a String
  4. Generate all rotations of a given string
  5. Minimum rotations required to get the same string
  6. Check if strings are rotations of each other or not
  7. Check if a string can be obtained by rotating another string 2 places
  8. Count rotations divisible by 4
  9. Check if all rows of a matrix are circular rotations of each other
  10. Print reverse of a string using recursion
  11. Print words of a string in reverse order
  12. Program to reverse a string (Iterative and Recursive)
  13. Write a program to reverse an array or string
  14. Reverse an array without affecting special characters
  15. Reverse words in a given string
  16. Reverse individual words
  17. Reverse a string preserving space positions
  18. Reverse string without using any temporary variable
  19. Print reverse string after removing vowels
  20. Reverse vowels in a given string
  21. Reverse String according to the number of words
  22. Reverse each word in a linked list node
  23. Find if an array of strings can be chained to form a circle

Sorting & Searching :

Case Sensitive String :

Occurrence Based String :

  1. Given a string, find its first non-repeating character
  2. Print all permutations with repetition of characters
  3. Find the first non-repeating character from a stream of characters
  4. Convert to a string that is repetition of a substring of k length
  5. Smallest length string with repeated replacement of two distinct adjacent
  6. Distributing all balls without repetition
  7. Maximum consecutive repeating character in string
  8. Minimum number of deletions so that no two consecutive are same
  9. K’th Non-repeating Character
  10. Find repeated character present first in a string
  11. Find the first repeated word in a string
  12. Find the first repeated character in a string
  13. Second most repeated word in a sequence
  14. Most frequent word in an array of strings
  15. Efficiently find first repeated character in a string without using any additional data structure in one traversal
  16. Queries for characters in a repeated string
  17. Return maximum occurring character in an input string
  18. Generate two output strings depending upon occurrence of character in input string.
  19. Print characters and their frequencies in order of occurrence
  20. Program to count occurrence of a given character in a string
  21. Check if all occurrences of a character appear together
  22. Group all occurrences of characters according to first appearance
  23. Print the string by ignoring alternate occurrences of any character
  24. Print the string after the specified character has occurred given no. of times
  25. Find all occurrences of a given word in a matrix
  26. Replace all occurrences of string AB with C without using extra space
  27. Rearrange a binary string as alternate x and y occurrences
  28. Remove recurring digits in a given number
  29. Find the most frequent digit without using array/string

Spacing :

Anagram :

Palindrome :



Binary String :

  1. Count of operations to make a binary string”ab” free
  2. Change if all bits can be made same by single flip
  3. Length of Longest sub-string that can be removed
  4. Number of flips to make binary string alternate
  5. 1’s and 2’s complement of a Binary Number
  6. Efficient method for 2’s complement of a binary string
  7. Count binary strings with k times appearing adjacent two set bits
  8. Count strings with consecutive 1’s
  9. Generate all binary strings from given pattern
  10. Add two bit strings
  11. Count number of binary strings without consecutive 1’s
  12. Generate all binary permutations such that there are more or equal 1’s than 0’s before every point in all permutations
  13. Check if a string follows a^nb^n pattern or not
  14. Binary representation of next number
  15. Binary representation of next greater number with same number of 1’s and 0’s
  16. Maximum difference of zeros and ones in binary string
  17. Check if a binary string has a 0 between 1s or not | Set 2
  18. Min flips of continuous characters to make all characters same in a string
  19. Concatenation of two strings in PHP
  20. Program to add two binary strings
  21. Convert String into Binary Sequence
  22. Generate all binary strings without consecutive 1’s
  23. Minimum number of characters to be removed to make a binary string alternate
  24. Check divisibility of binary string by 2^k
  25. Removing elements between the two zeros
  26. Find i’th Index character in a binary string obtained after n iterations
  27. Number of substrings with odd decimal value in a binary string
  28. Generate n-bit Gray Codes
  29. Print N-bit binary numbers having more 1’s than 0’s in all prefixes
  30. Add n binary strings

More >>

Lexicographic pattern :

Pattern Searching :

Split String :



Balance Parentheses & Bracket Evaluation :

Conversion :

Misc :

Quick Links :

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



My Personal Notes arrow_drop_up