# Category Archives: Hash

## Replace each element by the difference of the total size of the array and frequency of that element

Given an array of integers, the task is to replace every element by the difference of the total size of the array and its frequency.… Read More »

## Minimum number of operations required to delete all elements of the array

Given an integer array arr, the task is to print the minimum number of operations required to delete all elements of the array. In an… Read More »

## Find maximum distance between any city and station

Given the number of cities n numbered from 0 to n-1 and the cities in which stations are located, the task is to find the… Read More »

## Count numbers in range such that digits in it and it’s product with q are unequal

Given a range of numbers [l, r] and an integer . The task is to count all such number in the given range such that… Read More »

## String with frequency of characters in Lucas Sequence

Given a string ‘str’ containing lowercase English alphabets, the task is to find whether the frequencies of the characters of the string are in Lucas… Read More »

## Generating Random String Using PHP

Generate a random, unique, alpha-numeric string using PHP. Examples: EA070 aBX32gTf APPROACH 1: Brute Force The first approach is the simplest one to understand and… Read More »

## Remove elements from the array whose frequency lies in the range [l, r]

Given an array of integers, remove the elements from the array whose frequency lies in the range [l, r]. Examples: Input : arr[] = {… Read More »

## Find array elements with frequencies in range [l , r]

Given an array of integers, find the elements from the array whose frequency lies in the range [l, r]. Examples: Input : arr[] = {… 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. Examples: Input : arr[] = { 1, 2, 5, 2, 2,… Read More »

## Find the k smallest numbers after deleting given elements

Given an array of integers, find the k smallest numbers after deleting given elements. In case of repeating elements delete only one instance in the… Read More »

## Find the k largest numbers after deleting the given elements

Given an array of integers, find the k largest number after deleting the given elements. In case of repeating elements, delete one instance for every… Read More »

## Remove elements that appear strictly less than k times

Given an array of integers, remove all the elements which appear strictly less than k times. Examples: Input : arr[] = {1, 2, 2, 3,… Read More »

## Remove duplicates from unsorted array using Map data structure

Given an unsorted array of integers, Print the array after removing the duplicate elements from it. We need to print distinct array elements according to… Read More »

## Remove elements from the array which appear more than k times

Given an array of integers, remove all the occurrences of those elements which appear strictly more than k times in the array. Examples: Input :… Read More »

## Replace duplicates with greater than previous duplicate value

Given an array of elements and change the array in such a way that all the elements on the array are distinct. if you are… Read More »