Skip to content

Tag Archives: frequency-counting

Given an array arr[] of N integers, the task is to find the number of pairs of array elements (arr[i], arr[j]) such that the difference… Read More
Given an array arr[] consisting of N integers, the task for each array element is to find the absolute difference between the count of distinct… Read More
Given a string S of size N, the task is to find the maximum sum of values assigned to all the alphabets of the string… Read More
Given a string S of N characters, the task is to calculate the total number of non-empty substrings such that at most one character occurs… Read More
Given an array arr[] of N integers, the task is to maximize the sum of selected numbers over all the operations such that in each… Read More
Given string str of size N consisting of only 0, 1, and 2, the task is to find the number of substrings that consists of… Read More
Given an array arr[] consisting of N pairs of the form {A, B}, the task is to count the pairs of indices (i, j) such… Read More
Given two strings str1 and str2 of same length N, the task is to check if there exists any permutation possible in any of the… Read More
Given an array arr[] consisting of N integers, the task is to find the minimum number of array elements that must be removed such that… Read More
Given an array arr[] consisting of N integers, the task is to find the number of triplets whose indices and elements at that indices are… Read More
Given two integers L and R, the task is to find the count of integers in the range [L, R] such that the frequency of… Read More
Given an array arr[] consisting of N integers, the task is to find the maximum element with the minimum frequency. Examples: Input: arr[] = {2,… Read More
Given a string str[] of size N, the task is to encode it in such a way that the last occurrence of each character occurs… Read More
Given a binary string, the task is to print the length of the longest substring containing only ‘1’. Examples: Input: 110Output: 2Explanation: Length of the… Read More
Given an array arr[] of size N representing digits from 0 to 9, the task is to count the number of distinct odd N-digit integers… Read More