Skip to content

Tag Archives: cpp-vector

Given two same-sized arrays A[] and B[] (both arrays contain distinct elements individually but may have some common elements), the task is to form a… Read More
Given an array of integers greater[] in which every value of array represents how many elements are greater to its right side in an unknown… Read More
Given two arrays a[] and b[], we need to build an array c[] such that every element c[i] of c[] contains a value from a[]… Read More
You are given an array of n distinct integers. Your task is to divide this array into three non-empty sets so as the following conditions… Read More
Given two expressions in the form of strings. The task is to compare them and check if they are similar. Expressions consist of lowercase alphabets,… Read More
A STL based simple implementation of BFS using queue and vector in STL. The adjacency list is represented using vectors of vector.  In BFS, we… Read More
Given two Binary Search Trees consisting of unique positive elements, we have to check whether the two BSTs contain the same set of elements or… Read More
Given an integer array and two numbers k and m. Print k numbers from the array, such that difference between any two pairs is divisible… Read More
A 2D vector is a vector of the vector. Like 2D arrays, we can declare and assign values to a 2D vector! Assuming you are… Read More
Given a generic tree, perform a Level order traversal and print all of its nodes Examples:  Input : 10 / / \ \ 2 34… Read More
When we pass an array to a function, a pointer is actually passed. However, to pass a vector there are two ways to do so:… Read More
std::equal_range is used to find the sub-range within a given range [first, last) that has all the elements equivalent to a given value. It returns… Read More
In the case of arrays, there is not much choice to copy an array into another, other than the iterative method i.e running a loop… Read More
We have discussed some of the cases of sorting 2D vector in below set 1 and set 2.Sorting 2D Vector in C++ | Set 1… Read More
We have discussed some of the cases of sorting 2D vector in below set 1. Sorting 2D Vector in C++ | Set 1 (By row… Read More