A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. The latter may allow its elements to be mutated and the length changed, or it may be fixed (after creation).
A string is generally understood as a data type and is often implemented as an array of bytes (or words) that stores a sequence of elements, typically characters. String datatypes have historically allocated one byte per character. In C, the length of a string can be stored implicitly by using a special terminating character; often this is the null character (NUL), which has all bits zero.
Following is the list of commonly asked string interview questions:
- Check if a string is a rotated palindrome or notMedium
- Longest Palindromic Substring ProblemMedium
- Check if a repeated subsequence is present in a string or notHard
- Check if strings can be derived from each other by circularly rotating themEasy
- Check if a set of moves is circular or notMedium
- Convert a number into a corresponding excel column nameMedium
- Determine whether two strings are anagram or notEasy
- Find all interleaving of given stringsEasy
- Isomorphic StringsMedium
- Find all possible palindromic substrings of a stringHard
- Find all possible combinations of words formed from the mobile keypadHard
- Find all possible combinations by replacing given digits with characters of the corresponding listHard
- >Find all words that follow the same order of characters as given patternMedium
- Group anagrams together from a list of wordsMedium
- Find minimum operations required to transform a string into another stringHard
- Determine whether a string can be transformed into another string in a single editMedium
- In-place remove all occurrences of
ABandCfrom a stringEasy - Find the longest even-length palindromic sum substring of a stringMedium
- Print string in the zigzag form in
krowsMedium - Run Length Encoding (RLE) Data Compression AlgorithmEasy
- Find the longest substring of a string containing
kdistinct charactersHard - Find all palindromic permutations of a stringMedium
- Find all substrings of a string that are a permutation of another stringMedium
- Find the longest substring of a string containing distinct charactersMedium
- Find all permutations of a string – C++, Java, PythonHard
- Iterative approach to finding permutations of a stringHard
- Find all lexicographically next permutations of a string sorted in ascending orderHard
- Lexicographically Minimal String RotationMedium
- Find all strings of a given length containing balanced parenthesesMedium
- Find all combinations of non-overlapping substrings of a stringMedium
- Determine whether a string is a palindrome or notEasy
- Find the minimum number of inversions needed to make an expression balancedMedium
- Construct the longest palindrome by shuffling or deleting characters from a stringMedium
- Print all combinations of phrases formed by picking words from each of the given listsMedium
- Break a string into all possible combinations of non-overlapping substringsMedium
- Remove all extra spaces from a stringMedium
- Remove adjacent duplicate characters from a stringEasy
- Find the first non-repeating character in a string by doing only one traversal of itMedium
- Find all n-digit strictly increasing numbers (Bottom-up and Top-down approach)Medium
- Find all n-digit binary numbers having more 1’s than 0’s for any prefixMedium
- Find all n-digit numbers with a given sum of digitsHard
- Find all n-digit binary numbers with k-bits set where
kranges from 1 tonHard - Find all n-digit binary numbers with an equal sum of bits in their two halvesHard
- Find all n-digit numbers with equal sum of digits at even and odd indicesHard
- Find all lexicographic permutations of a stringHard
- Lexicographic rank of a stringHard
- Find all lexicographically previous permutations of a string sorted in descending orderHard
- Replace all non-overlapping occurrences of a patternMedium
- Find all substrings containing exactly
kdistinct charactersMedium - Introduction to Pattern MatchingBeginner
- Implementation of KMP AlgorithmHard
- Reverse a string using recursionEasy
- Determine whether the characters of a string follow a specified order or notMedium
- In-place remove all adjacent duplicates from a stringMedium
- Check if a sentence is syntactically correct or notMedium
- Number to word conversionHard
- Implement strstr function in JavaEasy
- Shortest Superstring ProblemHard
- Find the shortest route in a device to construct a given stringMedium
- Find the minimum number possible by doing at-most
kswapsMedium - Determine whether a string matches with a given patternHard
- Find all occurrences of the given string in a character matrixHard
- Difference between Subarray, Subsequence, and SubsetBeginner
- Check if an expression is balanced or notEasy
- Find duplicate parenthesis in an expressionMedium
- Evaluate a postfix expressionEasy
- Decode a given sequence to construct a minimum number without repeated digitsHard
- Convert an infix expression into a postfix expressionMedium
- Reverse a string using a stack data structureEasy
- Find all binary strings that can be formed from a wildcard patternMedium
- Find the length of the longest balanced parenthesis in a stringHard
- Reverse text without reversing individual wordsMedium
- Reverse a string without using recursionEasy
- Combinations of words formed by replacing given numbers with corresponding alphabetsHard
- Longest Common Prefix (LCP) ProblemEasy
- Longest Common Subsequence ProblemMedium
- Longest Common Subsequence (LCS) | Space optimized versionMedium
- Longest Common Subsequence of k–sequencesMedium
- Longest Common Subsequence | Finding all LCSHard
- Longest Common Substring ProblemMedium
- Longest Palindromic Subsequence using Dynamic ProgrammingMedium
- Longest Repeated Subsequence ProblemMedium
- Implement Diff UtilityMedium
- Shortest Common Supersequence ProblemMedium
- Shortest Common Supersequence | Finding all SCSHard
- Shortest Common Supersequence Problem using LCSHard
- The Levenshtein distance (Edit distance) ProblemMedium
- Count the number of times a pattern appears in a given string as a subsequenceHard
- Word Break Problem – Dynamic ProgrammingHard
- Check if a string is k–palindrome or notHard
- Wildcard Pattern MatchingHard
- Find the minimum number of deletions required to convert a string into a palindromeMedium
- Find minimum cuts needed for the palindromic partition of a stringHard
- Check if a string matches with the given wildcard patternHard
- Check if a string is interleaving of two other given stringsMedium
- Find correct order of alphabets in a given dictionary of ancient originHard
- Find first
knon-repeating characters in a string in a single traversalMedium - Check if a linked list of strings is palindromicEasy
- Generate binary numbers between 1 to
nusing a queueEasy - Longest Common Prefix in a given set of strings (using Trie)Medium
- Lexicographic sorting of a given set of keysMedium
- Find the maximum occurring word in a given set of stringsEasy
- Find first
kmaximum occurring words in a given set of stringsMedium - Word Break Problem – Using Trie Data StructureMedium
- Find all words matching a pattern in the given dictionaryMedium
- Find the shortest unique prefix for every word in an arrayMedium
Thanks for reading.
To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.
Like us? Refer us to your friends and support our growth. Happy coding :)