## Count triplet pairs (A, B, C) of points in 2-D space that satisfy the given condition

Given N points in 2 dimensional space. The task is to count the number of triplets pairs (A, B, C) such that point B is… Read More »

## How to create an unordered_map of pairs in C++?

Unordered Map does not contains a hash function for a pair, So if we want to hash a pair then we have to explicitly provide… Read More »

## Find the missing elements from 1 to M in given N ranges | Set-2

Given an integer and ranges (e.g. [a, b]) which are intersecting and overlapping. The task is to find all the number within the range that… 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 »

## Print Minimum of all Subarrays using set in C++ STL

Given an array of size N and an integer K, find the minimum for each and every contiguous subarray of size K. Examples: Input :… Read More »

## Sets of pairs in C++

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value… Read More »

## Perform the given queries on the rooted tree

Given a rooted tree and not necessarily binary. The tree contains N nodes, labeled 1 to N. You are given the tree in the form… Read More »

## Check if a king can move a valid move or not when N nights are there in a modified chessboard

Given an infinite chessboard with the same rules as that of chess. Also given are N knights coordinates on the infinite chessboard(-10^9 <= x, y… Read More »

## Minimum number of swaps required to sort an array | Set 2

Given an array of N distinct elements, find the minimum number of swaps required to sort the array. Note: The problem is not asking to… Read More »

## Count number of triplets with product equal to given number with duplicates allowed | Set-2

Given an array of positive integers(may contain duplicates) and a number ‘m’, find the number of unordered triplets ((Ai, Aj, Ak) and (Aj, Ai, Ak)… Read More »

## Longest subarray having average greater than or equal to x

Given an array of integers and an integer x. Find length of maximum size subarray having average of integers greater than or equal to x.… Read More »

## Priority queue of pairs in C++ (Ordered by first)

In C++, priority_queue implements heap. Below are some examples of creating priority queue of pair type. Max Priority queue (Or Max heap) ordered by first… Read More »

## Sum of minimum difference between consecutive elements of an array

Given an array of pairs where each pair represents a range, the task is to find the sum of the minimum difference between the consecutive… Read More »

## Merge k sorted arrays | Set 2 (Different Sized Arrays)

Given k sorted arrays of possibly different sizes, merge them and print the sorted output. Examples: Input: k = 3 arr[][] = { {1, 3},… Read More »

## LFU (Least Frequently Used) Cache Implementation

Least Frequently Used (LFU) is a caching algorithm in which the least frequently used cache block is removed whenever the cache is overflowed. In LFU… Read More »