# Category Archives: Hash

## Count of subsequences consisting of the same element

Given an array A[] consisting of N integers, the task is to find the total number of subsequence which contain only one distinct number repeated… Read More »

## Check if N leaves only distinct remainders on division by all values up to K

Given a two integers N and K, the task is to check if N leaves only distinct remainders when divided by all integers in the… Read More »

## String hashing using Polynomial rolling hash function

What is String-Hashing?  String hashing is the way to convert a string into an integer known as hash of that string.An ideal hashing is the… Read More »

## Print all Strings from array A[] having all strings from array B[] as subsequence

Given two arrays A[] and B[] consisting of strings, the task is to print the strings from array A[] having all strings in B[] as… Read More »

## Count of triplets in an Array such that A[i] * A[j] = A[k] and i < j < k

Given an array A[ ] consisting of N positive integers, the task is to find the number of triplets A[i], A[j] & A[k] in the… Read More »

## Count of pairs of strings whose concatenation forms a palindromic string

Given an array A[ ] consisting of N strings, the task is to count the number of pairs of possible strings that on merging forms… Read More »

## Find the word with most anagrams in a given sentence

Given a string S in the form of a sentence, the task is to find the word from the text with maximum number of its… Read More »

## Missing vertex among N axis-parallel rectangles

Given N axis-parallel rectangles in a 2-D cartesian coordinate system and coordinates of 4N-1 vertices, the task is to find the single vertex missing.Examples: Input:… Read More »

## Count distinct substrings of a string using Rabin Karp algorithm

Given a string, count the number of distinct substrings using Rabin Karp Algorithm. Examples:  Input : str = “aba” Output : 5 Explanation : Total… Read More »

## Product of divisors of a number from a given list of its prime factors

Given an array arr[] representing a list of prime factors of a given number, the task is to find the product of divisors of that… Read More »

## Check if an array can be split into subsets of K consecutive elements

Given an array arr[] and integer K, the task is to split the array into subsets of size K, such that each subset consists of… Read More »

## Lexicographical smallest number after at most K consecutive swaps

Given a number in form of string str and an integer K, the task is to find the smallest integer that can be formed after… Read More »

## Count of unique digits in a given number N

Given a number N, the task is to count the number of unique digits in the given number. Examples: Input: N = 22342 Output: 2 Explanation:The digits… Read More »

## Count of unique palindromic strings of length X from given string

Given a string s and an integer X, our task is to find the number of distinct palindromic strings of length X from the given… Read More »

## K most occurring strings

Given an array arr[] of N strings and an integer K, the task is to print K strings which occurred the most number of times… Read More »