Count ways to partition a Binary String such that each substring contains exactly two 0s
Given binary string str, the task is to find the count of ways to partition the string such that each partitioned substring contains exactly two 0s....
read more
Maximize non-overlapping Substrings by splitting String into groups with K or (K+1) 1s
Given a binary string S of length N and an integer K, the task is to find the maximum number of non-overlapping substrings that can be obtained by splitting it as per the following conditions:...
read more
Remove last occurrence of a word from a given sentence string
Given two strings S and W of sizes N and M respectively, the task is to remove the last occurrence of W from S. If there is no occurrence of W in S, print S as it is....
read more
Red Black Tree vs AVL Tree
In this post, we will compare Red-Black Tree and AVL Tree....
read more
Count substrings having frequency of a character exceeding that of another character in a string
Given a string S of size N consisting of characters a, b, and c only, the task is to find the number of substrings of the given string S such that the frequency of character a is greater than the frequency of character c....
read more
Count of Distinct Substrings occurring consecutively in a given String
Given a string str, the task is to find the number of distinct substrings that are placed consecutively in the given string....
read more
AbstractQueue clear() method in Java with examples
The clear() method of AbstractQueue removes all of the elements from this queue. The queue will be empty after this call returns....
read more
Count of substrings whose Decimal equivalent is greater than or equal to K
Given an integer K and a binary string S of length N, the task is to find out the number of substrings whose decimal equivalent is greater than or equal to K....
read more
Maximum consecutive occurrences of a string in another given string
Given two strings str1 and str2, the task is to count the maximum consecutive occurrences of the string str2 in the string str1....
read more
Lexicographically largest string possible by reversing substrings having even number of 1s
Given a binary string S, the task is to convert the given string S to its lexicographic maximum form by reversing substrings having an even number of 1s....
read more
Remove minimum characters from string to split it into three substrings under given constraints
Given a string str of lowercase alphabets, the task is to remove minimum characters from the given string so that string can be break into 3 substrings str1, str2, and str3 such that each substring can be empty or can contains only characters ‘a’, ‘b’, and ‘c’ respectively.Example:...
read more
Number of substrings that start with “geeks” and end with “for”
Given a string str consisting of lowercase English alphabets, the task is to find the count of substrings that start with “geeks” and end with “for”....
read more