Given a sorted array, arr[] consisting of N integers, the task is to find the frequencies of each array element. Examples: Input: arr[] = {1,… Read More

Frequency-counting - Basic Articles

Given two arrays A[] and B[] consisting of N positive integers and an integer K, the task is to find the Kth smallest element in… Read More

Given a string S consisting of N lowercase alphabets, the task is to modify the string S by replacing each character with the alphabet whose… Read More

Given a string S of length N, the task is to find the minimum number of characters required to be removed such that every distinct… Read More

Given a string S consisting of lowercase alphabets, the task is to check whether the given string can be rearranged such that the string can… Read More

Given a string S consisting of characters 0, 1, and ‘?’, the task is to count all possible combinations of the binary string formed by… Read More

Given a binary string, str of length N, the task is to find the maximum sum of the count of 0s on the left substring… Read More

Given an array arr[] of size N, the task is to find the minimum increments by 1 required to be performed on the array elements… Read More

Given an array arr[] of size N and an integer K, the task is to find an array element which contains the digit K maximum… Read More

Given two arrays, arr[] and brr[] of size N and M respectively, the task is to find the count of pairs (arr[i], brr[j]) such that… Read More

Given an array arr[], the task is to find the length of the longest subsequence of the array arr[] such that all adjacent elements in… Read More

Given an array arr[] consisting of N positive integers, the task is to maximize the number of subsequences that can be obtained from an array… Read More

Given an array arr[] consisting of N integers, the task is to find all the array elements which occurs more than floor (n/3) times. Examples:… Read More

Given an array arr[] of size N, the task is to find the length of the longest subsequence consisting of distinct elements only. Examples: Input:… Read More

Given an array arr[] of size N consisting of equal length strings, the task is to check if it is possible to make all strings… Read More

Given a string S and an integer N, the task is to check if it is possible to generate any string N times from the… Read More

Given an array A[] consisting of N integers, the task is to find the total number of subsequence which contain only one distinct number repeated… Read More

Given a string str, the task is to find the frequency of each character of a string using an unordered_map in C++ STL. Examples: Input:… Read More

Given a string str consisting of alphanumeric characters, the task is to check whether the string contains all the digits from 1 to 9. Examples: … Read More