Find maximum element among the elements with minimum frequency in given Array
Given an array arr[] consisting of N integers, the task is to find the maximum element with the minimum frequency....
read more
Maximum frequencies in each M-length subarray
Given an array arr[] consisting of N integers and a positive integer M, the task is to find the maximum frequency for each M-length subarray ( 0 < M ? N)....
read more
Count subarrays having each distinct element occurring at least twice
Given an array arr[] of size N, the task is to count the number of subarrays from the given array, such that each distinct element in these subarray occurs at least twice....
read more
Replace every elements in the array by its frequency in the array
Given an array of integers, replace every element by its frequency in the array....
read more
Sum of all even frequency elements in Matrix
Given a NxM matrix of integers containing duplicate elements. The task is to find the sum of all even occurring elements in the given matrix. That is the sum of all such elements whose frequency is even in the matrix....
read more
Find the overlapping sum of two arrays
Given two arrays A[] and B[] having n unique elements each. The task is to find the overlapping sum of the two arrays. That is the sum of elements that is common in both of the arrays....
read more
Number of ordered points pair satisfying line equation
Given an array of n integers, slope of a line i. e., m and the intercept of the line i.e c, Count the number of ordered pairs(i, j) of points where i ? j, such that point (Ai, Aj) satisfies the line formed with given slope and intercept....
read more
Smallest element repeated exactly ‘k’ times (not limited to small range)
Given an array of size n, the goal is to find out the smallest number that is repeated exactly ‘k’ times where k > 0? And Examples:...
read more
How to Get First or Last Entry from Java LinkedHashMap?
LinkedHashMap is a predefined class in Java which is similar to HashMap, containing key and its respective value unlike HashMap, In LinkedHashMap insertion order is preserved. The task is to get the first and last entry present in LinkedHashMap. Iteration to get last and first value. The first and the last entry in Map is the entry that is inserted first and the entry that is to be inserted last where insertion order is preserved....
read more
How to Maintain Insertion Order of the Elements in Java HashMap?
When elements get from the HashMap due to hashing the order they inserted is not maintained while retrieval. We can achieve the given task using LinkedHashMap. The LinkedHashMap class implements a doubly-linked list so that it can traverse through all the elements....
read more
Minimum substring removals required to make all remaining characters of a string same
Given a string str of length N, the task is to find the minimum number of substrings required to be removed to make all the remaining characters of the string same....
read more
Remove characters from a String that appears exactly K times
Given a string of lowercase letters str of length N, the task is to reduce it by removing the characters which appear exactly K times in the string....
read more