Skip to content
Frequency-counting - Basic Articles
Given an array where every element occurs ‘a’ times, except one element which occurs b (a>b) times. Find the element that occurs b times. Examples:  … Read More
You are given a string s (only lowercase alphabet) with length n. Print the position of every character of the string it must acquire so… Read More
Given a string, find minimum number of changes to it so that all substrings of the string become distinct.Examples :   Input : str = "aab"… Read More
Given an array, find the least frequent element in it. If there are multiple elements that appear least number of times, print any one of… Read More
You are given two strings str1 and str2. You have to check if the two strings share a common substring.Examples :   Input : str1 =… Read More
Given a string, convert the string to palindrome without any modifications like adding a character, removing a character, replacing a character etc.  Examples:  Input :… Read More
Given a string ‘s’ and an integer k, find other string ‘t’ such that ‘t’ is the largest subsequence of given string ‘s’ and each… 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 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 two strings str1 and str2, check if str2 can be formed from str1Example :   Input : str1 = geekforgeeks, str2 = geeks Output :… 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 an unsorted array of n integers which can contains n integers. Count frequency of all elements that are present in array. Examples: Input :… Read More
  Given a string S, the task is to remove all the duplicates in the given string. Below are the different methods to remove duplicates in… Read More