# Category Archives: Hash

## Find k numbers with most occurrences in the given array

Given an array of n numbers and a positive integer k. The problem is to find k numbers with most occurrences, i.e., the top k… Read More »

## Find all pairs (a, b) in an array such that a % b = k

Given an array with distinct elements, the task is to find the pairs in the array such that a % b = k, where k… Read More »

## Count pairs from two sorted arrays whose sum is equal to a given value x

Given two sorted arrays of size m and n of distinct elements. Given a value x. The problem is to count all pairs from both… Read More »

## Count subarrays having total distinct elements same as original array

Given an array of n integers. Count total number of sub-array having total distinct elements same as that of total distinct elements of original array.… Read More »

## Union and Intersection of two linked lists | Set-3 (Hashing)

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. Order of elements… Read More »

## Find distinct elements common to all rows of a matrix

Given a n x n matrix. The problem is to find all the distinct elements common to all rows of the matrix. The elements can… Read More »

## Maximum difference between first and last indexes of an element in array

Given an array of n integers. The task is to find the difference of first and last index of each distinct element so as to… Read More »

## Count subsets having distinct even numbers

Given a set of n numbers. The task is to count all the subsets of the given set which only have even numbers and all… Read More »

## First element occurring k times in an array

Given an array of n integers. The task is to find the first element that occurs k number of times. If no element occurs k… Read More »

## Largest subset whose all elements are Fibonacci numbers

Given an array with positive number the task is that we find largest subset from array that contain elements which are Fibonacci numbers. Asked in… Read More »

## k-th distinct (or non-repeating) element in an array.

Given an integer array, print k-th distinct element in an array. The given array may contain duplicates and the output should print k-th element among… Read More »

## Find duplicates in a given array when elements are not limited to a range

Given an array of n integers. The task is to print the duplicates in the given array. If there are no duplicates then print -1.… Read More »

## Top 20 Hashing Technique based Interview Questions

Find whether an array is subset of another array Union and Intersection of two Linked Lists Find a pair with given sum Find Itinerary from… Read More »

## Internal Working of HashMap in Java

In this article, we will see how hashmap’s get and put method works internally. What operations are performed. How the hashing is done. How the… Read More »

## Count the number of subarrays having a given XOR

Given an array of integers arr[] and a number m, count the number of subarrays having XOR of their elements as m. Examples: Input :… Read More »