- 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)
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
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
107 Views
Suppose we have a string S with n elements. Amal's song consists of n notes, which we will treat as positive integers. The diversity of a song is the number of different notes it contains. We want to make it more diverse. We cannot arbitrarily change the song. Instead, for each of the n notes in the song, she can either leave it as it is or increase it by 1. Given sequence is a song where integer is describing the notes, we have to find out the maximal, achievable diversity.Problem CategoryThe above-mentioned problem can be solved by applying Greedy ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
256 Views
Suppose we have an array A with n elements. There are n students in a university, n is even. The i-th student has programming skill equal to A[i]. The team leader wants to form n/2 teams. Each team should consist of exactly two students, and each student should belong to exactly one team. Two students can form a team only if their skills are equal. Students can solve problems to increase their skill. If they solve one problem, their skill will be increased by 1. We have to find the minimum total number of problems students should solve to form ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
328 Views
Suppose we have a number n. We have to count the number of integers x, in range 1 to n such that, that x is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).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 recurring appearance of the same problem over and ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
103 Views
Suppose we have a binary string S with n bits. Amal and Bimal are playing a game. Amal moves first, then Bimal, and they move alternatively. During their move, the player can select any number (not less than one) of consecutive equal characters in S and remove them. After the characters are removed, the characters to the left side and to the right side of the removed block become adjacent. The game ends when the string becomes empty, and the score of each player will be the number of 1-characters deleted by them. They both wants to maximize their score. ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
252 Views
Suppose we have a string S with n letters in lowercase. A string is strictly alphabetical string, if it follows the following rule −Write an empty string to TThen perform the next step n times;At the i-th step take i-th lowercase letter of the Latin alphabet and insert it either to the left of the string T or to the right of the string T (c is the i-th letter of the Latin alphabet).We have to check whether S is strictly alphabetical string or not.Problem CategoryTo solve this problem, we need to manipulate strings. Strings in a programming language are ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
131 Views
Suppose we have a n x n grid of characters with dots (.) and asterisks (*). All cells are marked as dot except two cells. We have to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes. If there are multiple solutions available, return any one of them.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 ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
135 Views
Suppose we have a numeric string S with n digits. We perform the following operation with the string S, no more than once. We select two numbers i and j (1 ≤ i ≤ j ≤ n) and removes characters from S string from positions i to j. We have to check whether the string S can be reduced to 2022 in no more than one operations or not.Problem CategoryTo solve this problem, we need to manipulate strings. Strings in a programming language are a stream of characters that are stored in a particular array-like data type. Several languages specify ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
88 Views
Suppose we have three numbers n, m and k. There is a n x m grid. we are currently at cell (0, 0) top left corner and we want to reach cell (n - 1, m - 1). We can move to the neighboring cells to the right or down. To reach down, it will take x rupees, and to reach right cell, it will take y rupees. We have to check whether we can reach cell (n - 1, m - 1) spending exactly k rupees or not. (The x and y are the current x and y coordinate ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
90 Views
Suppose we have four numbers a, b, c and d. In a box there are some numeri digits. There are 'a' number of digits 2, 'b' number of digits 3, 'c' number of digits 5 and 'd' number of digits 6. We want to compose numbers 32 and 256 from these digits. We want to make the sum of these integers as large as possible. (Each digit can be used no more than once, and unused digits are not counted in the sum).Problem CategoryThe above-mentioned problem can be solved by applying Greedy problem-solving techniques. The greedy algorithm techniques are types ... Read More