## Choose atleast two elements from array such that their GCD is 1 and cost is minimum

Given two integer arrays arr[] and cost[] where cost[i] is the cost of choosing arr[i]. The task is to choose a subset with at least… Read More »

## map get_allocator in C++ STL

map::get_allocator() is a built in function in C++ STL which is used to get allocator of container map. Syntax: Allocator_type get_allocator() Parameters: This function does… Read More »

## Find the Number of Maximum Product Quadruples

Given an array of N positive elements find the number of quadruple, (i, j, k, m) such that i < j < k < m… Read More »

## How to delete last element from a map in C++

If we wish to delete the last element from a map, we can use following methods : using prev(mp.end()) : what prev function do is,… Read More »

## How to traverse a STL map in reverse direction?

Map stores the elements in sorted order of keys. Now if we want to traverse it in reverse order we will use reverse_iterator of map.… Read More »

## Remove minimum elements from array so that max <= 2 * min

Given an array arr, the task is to remove minimum number of elements such that after their removal, max(arr) <= 2 * min(arr). Examples: Input:… Read More »

## Double ended priority queue

A double ended priority queue supports operations of both max heap (a max priority queue) and min heap (a min priority queue). The following operations… Read More »

## Count distinct pairs from two arrays having same sum of digits

Given two arrays arr1[] and arr2[]. The task is to find the total number of distinct pairs(formed by picking 1 element from arr1 and one… Read More »

## Print all pairs in an unsorted array with equal sum

Given an unsorted array A[]. The task is to print all unique pairs in the unsorted array with equal sum. Note: Print the result in… Read More »

## Find all good indices in the given Array

Given an array A[] of integers. The task is to print all indices of this array such that after removing the ith element from the… Read More »

## Check if frequency of character in one string is a factor or multiple of frequency of same character in other string

Given two strings, the task is to check whether the frequencies of a character(for each character) in one string is a multiple or a factor… Read More »

## Count pairs in an array such that both elements has equal set bits

Given an array arr with unique elements, the task is to count the total number of pairs of elements that have equal set bits count.… Read More »

## Count occurrences of the average of array elements with a given number

Given an array of integers and an integer . For every integer of the array a[i], the task is to calculate the count of numbers… Read More »

## Check whether frequency of characters in a string makes Fibonacci Sequence

Given a string with lowercase English alphabets. The task is to check whether the frequency of the characters in the string can be arranged as… Read More »

## Most frequent word in first String which is not present in second String

Given two string ‘S1’ and ‘S2’, the task is to return the most frequent (which is used the maximum number of times) word from ‘S1’… Read More »