## How to join two Vectors using STL in C++?

Given two vectors, join these two vectors using STL in C++. Example: Input: vec1 = {1, 45, 54, 71, 76, 12}, vec2 = {1, 7,… Read More »

## How to find common elements between two Vector using STL in C++?

Given two vectors, find common elements between these two vectors using STL in C++. Example: Input: vec1 = {1, 45, 54, 71, 76, 12}, vec2… Read More »

## Working with Array and Vectors using STL in C++

Using STL library it is very easy to perform certain basic operations on array like Sorting, searching, sum of elements, finding minimum and maximum element… Read More »

## Keep track of previous indexes after sorting a vector in C++ STL

Prerequisite: vector, vector pair sorting Given a vector, keep track of the present indexes corresponding to each element and after sorting print element with its… Read More »

## Minimum number of moves after which there exists a 3X3 coloured square

Given an N * N board which is initially empty and a sequence of queries, each query consists of two integers X and Y where… Read More »

## Rearrange Odd and Even values in Alternate Fashion in Ascending Order

Given an array of integers (both odd and even), the task is to arrange them in such a way that odd and even values come… Read More »

## Check if a triplet with given sum exists in BST

Given a Binary Search Tree and a SUM. The task is to check if there exists any triplet(group of 3 elements) in the given BST… Read More »

## Rearrange all elements of array which are multiples of x in decreasing order

Given an array of integers arr[] and an integer x, the task is to sort all the elements of the array which are multiples of… Read More »

## Print levels with odd number of nodes and even number of nodes

Given an N-ary tree, print all the levels with odd and even number of nodes in it. Examples: For example consider the following tree 1… Read More »

## Sort perfect squares in an array at their relative positions

Given an integer array , the task is to sort only the elements which are perfect squares at their relative positions in the array (positions… 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 »

## Count subarrays with Prime sum

Given an array A[] of integers. The task is to count total subarrays whose sum is prime with ( size > 1 ). Examples: Input… Read More »

## Count the number of elements in an array which are divisible by k

Given an array of integers. The task is to calculate the count of a number of elements which are divisible by a given number k.… Read More »

## Sorting array elements with set bits equal to K

Given an array of integers and a number . The task is to sort only those elements of the array whose total set bits are… Read More »