Given an array arr[] of size N and an integer S, the task is to find the count of quadruplets present in the given array… Read More

# Tag Archives: cpp-map

Given two integers K, X, and an array arr[] consisting of N distinct elements, the task is to find X elements closest to the Kth… Read More

Joining two different tables on their matching columns can be done using nested loops, but a more efficient and scalable way is to use multimaps.… Read More

Given an integer N, the task is to find the maximum value of function F(n) given by F(N) = max(N, F(N /2) + F(N /… Read More

Given an array arr[] consisting of N integers and 2D array queries[][] consisting of Q queries of the form {p, x}, the task for each… Read More

Given an array arr[] consisting of N integers, the task is to find the count of unordered pairs in the given array whose sum contains… Read More

Given string str, the task is to print the last character of the lexicographically smallest non-palindromic permutation of the given string. If no such permutation… Read More

Given two strings A and B, the task is to find the smallest substring of A having B as a subsequence. Examples: Input: A =… Read More

Given an integer, P denoting the number of chocolates and an array a[] where ai denotes the type of ith chocolate. There are N people… Read More

Given a Binary Tree, the task is to print the middle nodes of each level of a binary tree. Considering M to be the number… Read More

Given an array arr[] consisting of N positive integers, the task is to maximize the number of subsequences that can be obtained from an array… Read More

Given an array arr[] consisting of N integers, the task is to print all adjacent integer pairs from the array which appears more than once… Read More

Given two arrays arr[] and brr[] consisting of N integers, the task is to count the number of pairs (i, j) from both the array… Read More