Skip to content

Tag Archives: frequency-counting

Earlier we have discussed on how to check if both halves of the string have same set of characters. Now, we further extend our problem… Read More
Given a string s, find the number of pairs of characters that are same. Pairs (s[i], s[j]), (s[j], s[i]), (s[i], s[i]), (s[j], s[j]) should be… Read More
Given a string str of length n. The problem is to find the length of the longest sub-string in str having frequency of each character… Read More
Given two strings str1 and str2 of length n1 and n2 respectively. The problem is to find the length of the longest subsequence which is… Read More
Given a string S. The task is to check whether a the given string is Heterogram or not. A heterogram is a word, phrase, or… Read More
Given a string containing lowercase and uppercase letters. Sort it in such a manner such that the uppercase and lowercase letter comes in an alternate… Read More
Given two strings str1 and str2, check if str2 can be formed from str1Example :   Input : str1 = geekforgeeks, str2 = geeks Output :… Read More
Given an array of positive integers, find all the alphabets that we can make using elements of the array. Examples : Input : arr[] =… Read More
Given an input string and a substring. Find the frequency of occurrences of a substring in a given string. Examples:  Input : man (pattern) dhimanman… Read More
Given a string which contains lower alphabetic characters, we need to remove at most one character from this string in such a way that frequency… Read More
Given a ternary array (every element has one the three possible values 1, 2 and 3). Our task is to replace the minimum number of… Read More
Given N elements and a number K, find the longest subarray which has not more than K distinct elements.(It can have less than K) Examples:… Read More
Write a function to check whether two given strings are anagram of each other or not. An anagram of a string is another string that… Read More
Given a string, sort it in descending order.Examples:   Input : alkasingh Output : snlkihgaa Input : nupursingh Output : uusrpnnihg Input : geeksforgeeks Output :… Read More
Given a string, find the maximum number of characters between any two same character in the string. If no character repeats, print -1. Examples: Input… Read More