- 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++
![Prabhdeep Singh](https://www.tutorialspoint.com/assets/profiles/546958/profile/60_1428686-1667456005.jpg)
57 Views
Convert string means we have to make the same as a given string on the basis of a given condition. In this problem, we have given an array of strings ‘arr’ and string ‘T’ of size ‘M’. our task is to check if is it possible to make all the string present in an array as same as the given string T by removing any character from a string of an array ( arr[i] ) and inserting that character into any index of another string of the array ( arr[j] ). We can do this any number of times. If ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
294 Views
Binomial expansion is a mathematical formula used to expand the expressions of the form (a+b)^n, where n is a positive integer and a and b can be any real or complex numbers. The expansion gives the coefficients of the terms in the expansion. A binomial expansion can be represented as $$\mathrm{(a+b)^n= ^nC_0a^nb^0+ ^nC_1a^{n-1}b^1 + ^nCa^{n-2}b^2+...+ ^nC_ra^{n-r}b^r+...+ ^nC_na^0b^n}$$ where $\mathrm{^nC_r}$ are the binomial coefficients and is given by $\mathrm{^nC_r=\frac{n!}{r!\times(n−r)!}}$ where n! is the factorial of n The expansion can be used for calculating all the binomial terms using the formula above and putting it into the expansion equation. Problem ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
129 Views
Modifying an array of strings by replacing characters repeating in the same or remaining strings is a common problem in programming. It can be solved using hash tables, sets, arrays etc. The aim is to improve the time and space requirements while providing the same functionality. This problem can be encountered in many real-life scenarios, such as processing large text or cleaning up datasets with duplicates. Problem Statement Given an input string array arr[] containing lowercase and uppercase characters. The goal is to modify the array by removing characters from the strings which are repeating in the same string or ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
473 Views
Logic gates are the basic building block of a digital circuit. They take in one or two binary inputs and return a binary output. Since, using the term binary, the output and input can either be 0 or 1 or it can be said as “false” and “true” or “low” and “high”. There are 3 basic logic gates − AND Gate AND gate has two or more inputs and one output. It produces a high output if all inputs are high. The truth table for a two-input AND gate is given below − Input 1 Input 2 Output ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
44 Views
The circumference of a circle can be defined as the outer boundary of the circle. It is the perimeter of a circle. Each point around a circle follows certain properties as follows − Point (x, y) lying inside the circle such that, $\mathrm{x^2 + y^2 < R^2}$ Point (x, y) lying on the circle such that, $\mathrm{x^2 + y^2 = R^2}$ Point (x, y) lying outside the circle such that, $\mathrm{x^2 + y^2 > R^2}$ where R = radius of the circle. Problem Statement Given a string S representing a sequence of moves (L, R, U, D) and ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
1K+ Views
In computer programming, comments are text written with the source code but ignored by the compiler or interpreter. They are used to provide readability of code by describing the code and its functionality for someone who is reading the code other than a compiler or interpreter. They are not executed and do not affect the functionality of the overall program, they are just for programmer guidance. Each programming language has a different syntax to represent comments. Here are a few examples − C/C++ − In C or C++, single-lined comments begin with ‘//’ and multi-liner comments are enclosed in ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
715 Views
An overlapping area is an area that is shared by two objects. In the case of rectangles, it is the area of the rectangles that belong to both rectangles. In order to find the total areas of two overlapping rectangles, first er need to add the area of both rectangles respectively but in this total, the overlapping area is counted twice. Thus we need to subtract the overlapping area too. Problem Statement Given the bottom left and top right vertices of two rectangles. Find the total area covered by the two rectangles. Sample Example 1 Input bl_x1 = 0 bl_y1 ... Read More
![Divya Sahni](https://www.tutorialspoint.com/assets/profiles/684605/profile/60_270320-1690190282.png)
688 Views
The pairwise product of a set X = {a, b, c} can be defined as the sum of the product of all possible set pairs. The pairs of the set are, Y = {a * a, a * b, a *c, b * b, b * c, c * c}, where the product is commutative. Thus, the pairwise product of set X is the summation of elements of set Y i.e. aa + ab + ac + bb + bc + cc. In mathematical terms, the sum of possible pair products can be depicted as, $$\mathrm{\displaystyle\sum\limits_{i=1, j=i}^{i\leq n, j\leq n}\:(i, ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
368 Views
In this problem, we need to take the maximum and minimum elements of all sub−array of length K and add them to get the answer. The first solution approach is that traverse through all sub−arrays of size K, find the minimum and maximum element of each sub−array, and add them. The optimized approach to solve the problem is using the deque data structure. We will store the index of the minimum and maximum elements of the subarray in the deque. Problem statement − We have given an array nums[] containing N positive or negative integer values. We have also ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
68 Views
In this problem, we will reduce the array size to 1 or 0 by performing the given operations in each turn. We can sort the array in each turn to get the maximum elements in each iteration. Also, we can use the head data structure to improve the performance of the code. Problem statement − We have given a nums[] array. We need to decrease the array by performing the below operations. Choose two maximum elements of the array. If both elements are the same, remove both elements from the array. If both elements are not the same, remove ... Read More