A Set is a collection of distinct elements. Elements cannot be modified once added. There are various operations associated with sets such as union, intersection,… Read More

# Tag Archives: cpp-set

Given two arrays, A[] and B[] consisting of M pairs, representing the edges of the two binary trees of N distinct nodes according to the… Read More

Given N persons are standing in a circle and an integer K. If initially starting from the first position, the Kth alive person clockwise from… Read More

Given an array arr[] of size N, the task is to find the lexicographically smallest permutation of first 2*N natural numbers such that every ith… Read More

Given a string S consisting of N characters, the task is to print all palindromic strings of length 3 in lexicographical order that can be… Read More

Given a string path consisting of characters ‘N’, ‘S’, ‘E’ and ‘W’ denoting 1 unit movement in North, South, East, and West directions respectively, the… Read More

Given an array arr[] consisting of N distinct integers, the task is to print for each array element, all the greater elements present on its… Read More

Given a set S consisting of N integers and an element K, the task is to find the index of the element K in the… Read More

The find_by_order() is a built-in function of Ordered Set which is a Policy Based Data Structure in C++. Policy-based data structures are not part of… Read More

Given an integer N and two arrays A[][], representing the set of languages a person knows, and B[][], consisting of M pairs of friendships, the… Read More

Given a matrix mat[][] of dimensions N * M, and an integer K, the task is to find the maximum sum of any rectangle possible… Read More

Given two strings S1 and S2 of lengths M and N respectively, the task is to calculate the sum of the frequencies of the characters… Read More

Given two strings A and B, the task is to count the minimum number of operations required to construct the string B by following operations: … Read More

Given an array A[] consisting of positive integers, the task is to calculate the minimum possible deviation of the given arrayA[] after performing the following… Read More