Given a string S of length N, the task is to find the lexicographically smallest K-length subsequence from the string S (where K < N)....
Given a string str that consists of lowercase English letters and brackets. The task is to reverse the substrings in each pair of matching parentheses, starting from the innermost one. The result should not contain any brackets....
A repeating substring is a substring that occurs in two (or more) locations in the string. Your task is to find the longest repeating substring in a given string....
Given a string s consisting of ‘.’ and ‘*’, In one move you can shift ‘*’, one index left or one index right if there is a ‘.’ present there, the task is to make an arrangement such that all the * are adjacent to each other i.e. there is no ‘.’ between any two ‘*’ Print the minimum number of moves required to do so....
Given an IP address, remove leading zeros from the IP address....
Given a string str, its sub-strings are formed in such a way that all the sub-strings starting with the first character of the string will occur first in the sorted order of their lengths followed by all the sub-strings starting with the second character of the string in the sorted order of their lengths and so on. For example for the string abc, its sub-strings in the required order are a, ab, abc, b, bc and c. Now given an integer k, the task is to find the kth sub-string in the required order.Examples:...
Given string str, the task is to check whether every group of consecutive a’s is followed by a group of consecutive b’s of the same length. If the condition is true for every group then print 1 else print 0....
Given a string of size n, write functions to perform the following operations on a string-...
Given a string str of length N, the task is to find the minimum number of substrings required to be removed to make all the remaining characters of the string same....
Given a string of lowercase letters str of length N, the task is to reduce it by removing the characters which appear exactly K times in the string....
We are given a binary string containing 1’s and 0’s. Find the maximum length of consecutive 1’s in it....
Given a string s1 and a string s2, write a snippet to say whether s2 is a rotation of s1? (eg given s1 = ABCD and s2 = CDAB, return true, given s1 = ABCD, and s2 = ACBD , return false) Algorithm: areRotations(str1, str2)...