Given N bottles. The ith bottle has A[i] radius. Once a bottle is enclosed inside another bottle, it ceases to be visible. The task is… Read More

# Tag Archives: frequency-counting

Given an array arr[] of size N. The task is to find the sum of arr[i] % arr[j] for all valid pairs. Answer can be… Read More

Given an array arr[] of size N. The task is to find X – Y for each of the element where X is the count… Read More

Given a string str of lower case English alphabets. One can choose any two characters in the string and replace all the occurrences of the… Read More

Given a string S of length N and an integer P(1≤P≤N) denoting the position of a character in the string. The task is to find… Read More

Given two string s1 and s2, the task is to check if characters of the first string can be mapped with the character of the… Read More

Given a string str consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters separately such that if the ith… Read More

Given two strings str1 and str2 of lengths M and N respectively. The task is to find all the distinct string of length M +… Read More

Given a string of lowercase English alphabets and an integer 0 < K <= 26. The task is to divide the string into two parts… Read More

Given a linked list. Find the first element from the left which appears more than once. If all the elements are unique then print -1.Examples:… Read More

Given two integers N and K. Find the numbers of triplets (a, b, c) such that 0 ≤ a, b, c ≤ N and (a… Read More

Given an array arr[] of N integers, the task is to find the minimum deletions required such that frequency of arr[i] is exactly arr[i] in… Read More

Given an array of size N. The task to find the maximum possible number of elements divisible by 3 that are in the array after… Read More

Given N elements and the task is to implement a stack which removes and returns the maximum frequency element on every pop operation. If there’s… Read More

Given an array arr[] and an integer K, the task is to count the pairs whose sum of set bits is KExamples: Input: arr[] =… Read More