- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
183 Views
Suppose, we are given a graph that has n vertices. The vertices are numbered 1 to n, and they are connected by the edges given in the array 'edges'. Each vertex has an 'x' value within a number from 1 to n that is given in the array 'values'. Now, we have to find out the super vertices from the graph. A vertex i is called a 'super vertex' whenever the shortest path from vertex 1 to i doesn't have a vertex with the same 'x' value as the i-th vertex. We print out all the vertices satisfying this criterion.So, ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
172 Views
Suppose, we are given a grid that contains two types of cells; black cells, and white cells. The black cells are represented as '#' and the white cells are represented as '.'. The grid is given to us in an array of strings. Now, we have to perform the following.We convert each white cell to black that has a side shared with a black cell. We perform this operation until every cell of the grid is black.We count the number of iterations it takes to convert all cells of the grid to black. The grid at the start must contain ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
205 Views
Suppose, there is a building that has center coordinates xc, yc, and height h. We don't know the center coordinates of the building, but we are provided with n pieces of information that contain x and y coordinates and an altitude value a. The altitude of coordinates (x, y) is the maximum of (h - |x - xc| - |y - yc|, 0). We have to find out the center coordinates and the height of the building. The coordinate xi is given in the array x, yi is given in teg array y, and ai is given in array a.So, ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
258 Views
Suppose, we are given two integers n and m and there are k tuples of integers that contain four integer numbers {ai, bi, ci, di}. Four arrays a, b, c, d are given, and a[i] signifies the i-th tuple's a value. Now, let us consider a sequence dp that has n positive integers and 1
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
344 Views
Suppose n stations are connected by m tracks. The stations are named from 1 to n. The tracks are bidirectional, and we have to reach station dest from station src. Thes source and destination stations of the i-th railroad is given in the array 'roads' where roads[i] is of the format {station1, station2}. From the j-th station, a train leaves for all stations that are connected with the station at the multiples of time kj and each train takes tj amount of time to reach the destination. The values are given in an array 'departure' where each element is of ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
148 Views
Suppose, we are given a grid of dimensions h * w. The cells in the grid can contain either a bulb or obstacles. A light bulb cell illuminates the cells in its right, left, up, and down and the light can shine through the cells unless an obstacle cell blocks the light. An obstacle cell can not be illuminated and it blocks the light from a bulb cell from reaching the other cells. We are given the grid in an array of strings, where '#' represents an obstacle and '.' represents a vacant cell. We have only one bulb and ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
134 Views
Suppose, we are given a grid of dimensions h * w. The cells in the grid can contain either bulbs or obstacles. A light bulb cell illuminates itself and the cells in its right, left, up, and down and the light can shine through the cells unless an obstacle cell blocks the light. An obstacle cell can not be illuminated and it blocks the light from a bulb cell from reaching the other cells. So, given the position of the bulb cells in the grid in array 'bulb' and the position of obstacle cells in the array 'obstacles', we have ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
321 Views
Suppose, we are given an unweighted, undirected graph that contains n vertices and m edges. A bridge edge in a graph is an edge whose removal causes the graph to be disconnected. We have to find out the number of such graphs in a given graph. The graph does not contain parallel edges or self-loops.So, if the input is like n = 5, m = 6, edges = {{1, 2}, {1, 3}, {2, 3}, {2, 4}, {2, 5}, {3, 5}}, then the output will be 1.The graph contains only one bridge edge that is {2, 4}.To solve this, we will ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
288 Views
Suppose, we are given a grid of dimensions h x w. There are two types of cells in the grid, white and black cells. White cells are represented by '.', whereas black cells are represented by '#'. Now the grid has multiple black cells in it that form a polygon. We have to find out the number of sides that the polygon has. It is to be noted, that the outermost cells of the grid are always white.So, if the input is like h = 4, w = 4, grid = {"....", ".##.", ".##.", "...."}, then the output will be ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
2K+ Views
Suppose, we are given n numbers in array nums. We have to choose a pair of two numbers from the array, and there is a condition that the difference of their positions in the array is equal to the sum of the two numbers. There can be a total of n(n - 1)/2 number of total pairs from the given array of numbers. We have to find out the total number of such pairs from the array.So, if the input is like n = 8, nums = {4, 2, 1, 0, 1, 2, 3, 3}, then the output will be ... Read More