Skip to content

Tag Archives: frequency-counting

Given an n sized unsorted array, find median and mode using counting sort technique. Thia can be useful when array elements are in limited range.… Read More
Given two strings X and Y, we need to convert string X into an anagram of string Y with minimum replacements. If we have multiple… Read More
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 that the uppercase and lowercase letters come in an alternate manner… 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[] = {6,… 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:   Input… 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