- 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 7346 Articles for C++
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
242 Views
Suppose we have an array A with four lines. Amal wants to draw four line segments on a sheet of paper. The i-th segment to have its length equal to A[i]. These segments can intersect with each other, and each segment should be either horizontal or vertical. Amal wants to draw the segments in such a way that they enclose a rectangular space, and the area of that rectangular space should be as maximum as possible. We have to find the possible area value.Problem CategoryThe above-mentioned problem can be solved by applying Greedy problem-solving techniques. The greedy algorithm techniques are ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
261 Views
Suppose we have a string S with brackets. There are two types of brackets '(' ')' and '[', ']'. A string is called a regular bracket sequence (RBS) if it follows following types −empty string;'(' | RBS | ')';'[' | RBS | ']';RBS | RBS.Where '|' is a concatenation of two strings. In one move we can select a non-empty subsequence of the string S (not necessarily consecutive) that is an RBS, then remove it from the string and concatenate the remaining parts without changing the order. We have to find the maximum number of moves we can perform.Problem CategoryThe ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
370 Views
Suppose we have two string S and T, and another string R. There are two popular keyboard layouts represented in S and T, they differ only in letters positions. All the other keys are the same. In S and T, all keys of the first and the second layouts in the same order. R may have digits also. It is known that it was typed in the first layout, but the writer intended to type it in the second layout. We have to find the string maintaining the second layout. (Since all keys but letters are the same in both ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
138 Views
Suppose we have two numbers h and w. The height and width of a table. The table is divided into h × w cells. Into each cell of the table, we can either put a plate or keep it empty. As each guest has to be seated next to their plate, we can only put plates on the edge of the table — into the first or the last row of the rectangle, or into the first or the last column. To make the guests comfortable, no two plates must be put into cells that have a common side or ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
183 Views
Suppose we have a binary string S with n bits. Let an operation MEX of a binary string be the smallest digit among 0, 1, or 2 that does not occur in the string. For example, MEX(001011) is 2, because 0 and 1 occur in the string at least once, MEX(1111) is 0, because 0 is not present and 0 is minimum. From the given string S. You should cut it into any number of substrings such that each character is in exactly one substring. It is possible to cut the string into a single substring — the whole string. ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
199 Views
Suppose we have an array A with n elements and another value k. We have n barrels lined up in a row, they are numbered from left to right from one. Initially, the i-th barrel contains A[i] liters of water. We can pour water from one barrel to another. In one move, we can take two different barrels x and y (the x-th barrel shouldn't be empty) and pour any possible amount of water from barrel x to barrel y. (assume that barrels have infinite capacity). We have to find the maximum possible difference between the maximum and the minimum ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
83 Views
Suppose we have an array A with n elements and another value k. We want to perform k following operations. One operation is like −Let d is the maximum value of the arrayFor every index i from 1 to n, replace A[i] with d - A[i]We have to find the final sequence.Problem CategoryAn array in the data structure is a finite collection of elements of a specific type. Arrays are used to store elements of the same type in consecutive memory locations. An array is assigned a particular name and it is referenced through that name in various programming languages. ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
246 Views
Suppose we have two numbers a and b. In a coding challenge, there are 4 slots for participants in a team. There are a number of programmers and b number of mathematicians. We have to count how many teams can be formed, if: each team must have at lease one programmer and at least one mathematician.Problem CategoryVarious problems in programming can be solved through different techniques. To solve a problem, we have to devise an algorithm first, and to do that we have to study the particular problem in detail. A recursive approach can be used if there is a ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
90 Views
Suppose we have a string S with n characters and two values l and r. Amal has written song and shared it to Bimal. The song is a string consisting of lowercase English letters. Bimal made up a question about this song. The question is about a subsegment of the song starting from the index l to r. Bimal considers a substring made up from characters on this segment and repeats each letter in the subsegment k times, where k is the index of the corresponding letter in the alphabet. As an example, if the question is about the substring ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
197 Views
Suppose we have two binary strings S and T of size n. Consider there is a chessboard of size n by n.Currently, there are some pawns in the n-th row. There are also enemy pawns in the 1-st row. On one move, we can move one of our pawns. A pawn can move one square up (from (i, j) to (i−1, j)) if there is no pawn in the destination square. And a pawn can move one square diagonally up (from (i, j) to either (i−1, j−1) or (i−1, j+1)) if and only if there is an enemy pawn in ... Read More