## Sort elements by frequency | Set 5 (using Java Map)

Given an integer array, sort the array according to the frequency of elements in decreasing order, if frequency of two elements are same then sort… Read More »

Given an integer array, sort the array according to the frequency of elements in decreasing order, if frequency of two elements are same then sort… Read More »

In this sorting algorithm, Hash Function f is used with the property of Order Preserving Function which states that if . Hash Function: f(x) =… Read More »

Given a string str containing only lowercase alphabets, the task is to minimize the length of the string after performing the following operation: Delete all… Read More »

Given N numbers, the task is to find the minimum removal of numbers such that GCD of the remaining numbers is greater than initial GCD… Read More »

Given two arrays (which may or may not be sorted) of sizes M and N respectively. There arrays are such that they might have some… Read More »

Given N ranges of L-R. The task is to print the number which occurs the maximum number of times in the given ranges. Note: 1… Read More »

Given a binary array arr[] of size n and a value k. The task is to find the length of the longest subarray having difference… Read More »

Consider n boxes numbered arranged in a circle in increasing order in clockwise direction (numbered from 1 to n). You are given q queries, each… Read More »

Given two unsorted arrays arr1[] and arr2[]. They may contain duplicates. For each element in arr1[] count elements less than or equal to it in… Read More »

Given two arrays arr1[] and arr2[]. The task is to find the count of such elements in the first array whose at-least one factor is… Read More »

Prerequisites: Hashing Introduction and Collision handling by separate chaining How hashing works: For insertion of a key(K) – value(V) pair into a hash map, 2… Read More »

Suppose you are given an array with N elements with any integer values. You need to find minimum number of elements of the array which… Read More »

Given an array of integers.Let us say P is the product of elements of the array. Find the number of of distinct prime factors of… Read More »

In hashing there is a hash function that maps keys to some values. But these hashing function may lead to collision that is two or… Read More »

Given an array arr[] containing n integers. The problem is to find the length of the subarray having maximum sum. If there exists two or… Read More »