# Category Archives: Hash

## Hashing in DBMS

Prerequisite – Hashing Data Structure In database management system, When we want to retrieve a particular data, It becomes very inefficient to search all the… Read More »

## Maximum distinct elements after removing k elements

Given an array arr[] containing n elements. The problem is to find maximum number of distinct elements after removing k elements from the array. Note:… Read More »

## Game of replacing array elements

There are two players A and B who are interested in playing a game of numbers. In each move a player pick two distinct number,… Read More »

## Minimum cost to construct a string

Given a string s (containing lowercase letters only), we have to find the minimum cost to construct the given string. The cost can determined using… Read More »

## Length of longest strict bitonic subsequence

Given an array arr[] containing n integers. The problem is to find the length of the longest strict bitonic subsequence. A subsequence is called strict… Read More »

## Maximum array from two given arrays keeping order same

Given two same sized arrays A[] and B[] (both arrays contain distinct elements individually but may have some common elements), task is to form a… Read More »

## Number of GP (Geometric Progression) subsequences of size 3

Given n elements and a ratio r, find the number of G.P. subsequences with length 3. A subsequence is considered GP with length 3 with… Read More »

## Change string to a new character set

Given a 26 letter character set, which is equivalent to character set of English alphabet i.e. (abcd….xyz) and act as a relation. We are also… Read More »

## Different substrings in a string that start and end with given strings

Given a string s and two other strings begin and end, find the number of different substrings in the string which begin and end with… Read More »

## Last seen array element (last appearance is earliest)

Given an array that might contain duplicates, find the element whose last appearance is latest. Examples: Input : arr[] = {10, 30, 20, 10, 20}… Read More »

## Pair with given sum and maximum shortest distance from end

Given an array of N integers and an integer K, pick two distinct elements whose sum is K and find the maximum shortest distance of… Read More »

## Maximum consecutive numbers present in an array

Find the length of maximum number of consecutive numbers jumbled up in an array. Examples: Input : arr[] = {1, 94, 93, 1000, 5, 92,… Read More »

## Sorting using trivial hash function

Sorting using trivial hash function. Examples: Input : 9 4 3 5 8 Output : 3 4 5 8 9 We have read about various… Read More »

## Find if there is a rectangle in binary matrix with corners as 1

There is a given binary matrix, we need to find if there exists any rectangle or square in the given matrix whose all four corners… Read More »

## Non-overlapping sum of two sets

Given two arrays A[] and B[] of size n. It is given that both array individually contain distinct elements. We need to find sum of… Read More »