Skip to content

Category Archives: Strings

Given a string S of size N, consisting of digits [0 – 9] and character ‘.’, the task is to print the string that can… Read More
Given a string S and integers P and Q, which denotes the cost of removal of substrings “ab” and “ba” respectively from S, the task… Read More
Given a string S and a character X, the task is to generate a non-palindromic string by inserting the character X in the string S.… Read More
Given a positive integer N, the task is to find the lexicographically largest string consisting of lower-case English alphabets such that the sum of the… Read More
Given a string S consisting of N lowercase characters, the task is to find the starting and the ending indices ( 0-based indexing ) of… Read More
Given a string S and an integer N, the task is to remove N characters from the end of the string S. Input: S =… Read More
Given an array arr[] consisting of N strings, an array letter[] consisting of M lowercase characters, and an array score[] such that score[i] is the… Read More
Given a string S consisting of N characters and positive integer K, the task is to check if there exist any (K + 1) strings… Read More
Given a string S consisting of N lowercase alphabets, the task is to count the number of substrings whose frequency of each character is even.… Read More
Given an array arr[] consisting of N binary strings, and two integers A and B, the task is to find the length of the longest… Read More
Given a string S consisting of N characters, the task is to find the length of all prefixes of the given string S that are… Read More
Given a string S consisting of N characters and a positive integer K, the task is to count the number of substrings having at least… Read More
Given an array arr[] consisting of N strings, the task is to find the pair of strings that is not present in the array formed… Read More
Given a string S consisting of N alphabets and two positive integers L and U, representing the cost of converting any character to lowercase and… Read More
Given an array arr[] consisting of N strings, the task is to sort the array in ascending order after modifying each string by removing all… Read More