# Category Archives: Hash

## Longest subsequence such that every element in the subsequence is formed by multiplying previous element with a prime

Given a sorted array of N integers. The task is to find the longest subsequence such that every element in the subsequence is reachable by… Read More »

## Find the color of given node in an infinite binary tree

Given an infinitely long binary tree having a pattern as below: 1 / \ 2 3 / \ / \ 4 5 6 7 /… Read More »

## Count of pairs between two arrays such that the sums are distinct

Given two arrays a[] and b[], the task is to find the count of all pairs (a[i], b[j]) such that a[i] + b[j] is unique… Read More »

## Find the longest string that can be made up of other strings from the array

Given an array of strings arr[], the task is to find the largest string in the array which is made up of the other strings… Read More »

## Partition the string in two parts such that both parts have at least k different characters

Given a string of lowercase English alphabets and an integer 0 < K <= 26. The task is to divide the string into two parts… Read More »

## Flip minimum signs of array elements to get minimum sum of positive elements possible

Given an array of positive elements, you have to flip the sign of some of its elements such that the resultant sum of the elements… Read More »

## Rearrange characters in a string such that no two adjacent are same using hashing

Given a string str with repeated characters, the task is to rearrange the characters in a string such that no two adjacent characters are same.… Read More »

## Design a stack which can give maximum frequency element

Given N elements and the task is to implement a stack which removes and returns the maximum frequency element on every pop operation. If there’s… Read More »

## Find uncommon characters of the two strings | Set 2

Given two strings str1 and str2, the task is to find and print the uncommon characters of the two given strings in sorted order without… Read More »

## Count duplicates in a given linked list

Given a linked list. The task is to count the number of duplicate nodes in the linked list. Examples: Input: 5 -> 7 -> 5… Read More »

## Rearrange given string to maximize the occurrence of string t

Given two binary strings s and t. The task is to rearrange the string s in such a way that the occurrence of string t… Read More »

## Minimum number of given operations required to reduce the array to 0 element

Given an array arr[] of N integers. The task is to find the minimum number of given operations required to reduce the array to 0… Read More »

## Print characters having odd frequencies in order of occurrence

Given a string str containing only lowercase characters. The task is to print the characters having an odd frequency in the order of their occurrence.… Read More »

## Find the lexicographically smallest sequence which can be formed by re-arranging elements of second array

Given two arrays A and B of N integers. Reorder the elements of B in itself in such a way that the sequence formed by… Read More »

## Count of quadruplets with given Sum | Set 2

Given four arrays containing integer elements and an integer sum, the task is to count the quadruplets such that each element is chosen from a… Read More »