Thursday, February 20, 2020
Home Interview String Interview Questions

# String Interview Questions

### Check length of a string is equal to the number appended at its last

Given a string that is appended with a number at last, write a function that checks whether the length of the string excluding the...

### Generate all binary strings without consecutive 1’s

Given an integer k, write a function to print all binary strings of size k with no consecutive 1's Example INPUT k = 3 OUTPUT "000", "001", "101", "010",...

### Check if all rows of a matrix are circular rotations of each other

Given a matrix, write a function to find whether all rows are circular rotations of each other or not Example INPUT s =  a b c c b...

### Sort a string according to another string

Given two input strings, a pattern and a string. We need to sort the string according to the order defined by pattern. Pattern string...

### Check if string can become empty by recursively deleting given sub-string

Check if the given input string can be deleted completely by deleting given input sub-string recursively. Given sub-string should be present in the input string Examples a)...

### Smallest palindrome after replacement

Given input string contains lower case alphabets characters and dots(.). We need to replace all dots with some alphabet character in such a way...

### Check if string follows order of characters by a pattern or not

Check if characters in the given input string follows the same order as determined by characters present in the given input pattern. Examples a) Input string...

### split-four-distinct-strings

Check if the given input string can split into 4 strings such that each string is non-empty and different from each other. Examples a) Input string...

### Even sub-string count

In the given input string of digits, find the count of substrings which when convert into integer form even. Example Input string : 1234 Output : 6 2,...

### Reverse string without temporary variable

Write a function to reverse a string without using extra variable. Example Input string : “tutorial-cup” Output : “puc-lairotut” Time complexity : O(n) Algorithm 1. Store start index in low...

9,272Fans

### Multiplication of two matrices

Given two matrices, this function will multiply the two matrices and prints the result. Here, necessary and sufficient condition is the number of columns...

### Subtraction of two matrices

Given two matrices, we will write a function that subtracts the given matrices. Example INPUT A = { {1, 4, 7, 9}, {1, 6, 7, 6}, {6, 3, 7,...

### Check if two given matrices are identical

Given two matrices, we will write a function to check whether the two matrices are identical or not. That is, if all the elements...