# Tag Archives: cpp-pair

Given k sorted arrays of possibly different sizes, merge them and print the sorted output.Examples:  Input: k = 3 arr[][] = { {1, 3}, {2,â€¦ Read More
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
Given two arrays arr1[] and arr2[] sorted in ascending order and an integer K. The task is to find k pairs with the smallest sumsâ€¦ Read More
Given a sequence of N elements, only three operations can be performed on any element at most one time. The operations are:  Add one toâ€¦ Read More
Given K arrays of different size. The task is to check if there exist any two arrays which have the same sum of elements afterâ€¦ Read More
Given N numbers that have a permutation of first N numbers. In a single operation, any prefix can be reversed. The task is to findâ€¦ Read More
How to apply STL binary_search to vector of pairs(key, value), given that vector is sorted by its first value(key) struct compare in the code containsâ€¦ Read More
Given a set S (all distinct elements) of integers, find the largest d such that a + b + c = d where a, b, c,â€¦ Read More
Given an array of size N with repeated numbers, You Have to Find the top three repeated numbers.  Note : If Number comes same numberâ€¦ Read More
Given an array of N distinct element of at least size 2. A pair (a, b) in an array is defined as ‘a’ is theâ€¦ Read More
We are given two arrays. We need to sort one array according to another. Examples: Input : 2 1 5 4 9 3 6 7â€¦ Read More
Operator overloading is one of the features of Object oriented programming which gives an extra ability to an operator to act on a User-defined operand(Objects).â€¦ Read More
Map in STL is used to hash key and value. We generally see map being used for standard data types. We can also use mapâ€¦ Read More
Given an array of integers, sort the array according to frequency of elements. If frequencies of two elements are same, print them in increasing order.â€¦ Read More