# Category Archives: Hash

## Remove minimum number of elements such that no common element exist in both arraySeptember 23, 2017

Given two arrays A[] and B[] consisting of n and m elements respectively. Find minimum number of elements to remove from each array such that… Read More »

## Maximum area rectangle by picking four sides from arraySeptember 20, 2017

Given an array of n positive integers that represent lengths. Find out the maximum possible area whose four sides are picked from given array. Note… Read More »

## Sort elements by frequency | Set 4 (Efficient approach using hash)

Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first. Examples: Input… Read More »

## Minimum operation to make all elements equal in arraySeptember 18, 2017

Given an array with n positive integers. We need to find the minimum number of operation to make all elements equal. We can perform addition,… Read More »

## Find substrings that contain all vowelsSeptember 17, 2017

We have been given a string in lowercase alphabets. We need to print substrings that contain all the vowels at-least one time and there are… Read More »

## Frequency of a string in an array of stringsSeptember 4, 2017

You are given a collection of strings and a list of queries. For every query there is a string given. We need to print the… Read More »

## Concatenated string with uncommon characters of two stringsSeptember 2, 2017

Two strings are given and you have to modify 1st string such that all the common characters of the 2nd strings have to be removed… Read More »

## Smallest element repeated exactly ‘k’ times (not limited to small range)August 30, 2017

Given an array of size n, the goal is to find out the smallest number that is repeated exactly ‘k’ times where k > 0?… Read More »

## Find All Duplicate SubtreesAugust 14, 2017

Given a binary tree, find all duplicate subtrees. For each duplicate subtrees, we only need to return the root node of any one of them.… Read More »

## Minimum number of distinct elements after removing m itemsAugust 6, 2017

Given an array of items, an i-th index element denotes the item id’s and given a number m, the task is to remove m elements… Read More »

## Maximum possible sum of a window in an array such that elements of same window in other array are uniqueAugust 4, 2017

Given two arrays A and B of equal number of elements. Task is to find the maximum sum possible of a window in array B… Read More »

## Find top k (or most frequent) numbers in a streamJuly 29, 2017

Given an array of n numbers. Your task is to read numbers from the array and keep at-most K numbers at the top (According to… Read More »

## Minimum Index Sum for Common Elements of Two ListsJuly 28, 2017

Ram and Shyam want to choose a website to learn programming and they both have a list of favorite websites represented by strings. You need… Read More »

## Find any one of the multiple repeating elements in read only array

Given a read only array of size ( n+1 ), find one of the multiple repeating elements in the array where the array contains integers… Read More »

## Hash Table vs STL MapJuly 13, 2017

This article focus on : Compare and contrast Hash table and an STL Map. How is the hash table implemented? If the number of inputs… Read More »