- 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++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
167 Views
We are given a number and the task is to calculate the count of numbers from the range 0 till the given number let’s say, num having exactly one set bitSet bits in a binary number is represented by 1. Whenever we calculate the binary number of an integer value then it is formed as the combination of 0’s and 1’s. So, the digit 1 is known as set bit in the terms of the computer.Input − int num = 15Output − Count of numbers having only 1 set bit in the range [0, 15] are − 4Explanation − The ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
166 Views
We are given the total number of elements and the task is to calculate the total number of matrices with different orders that can be formed with the given data. A matrix has an order mxn where m are the number of rows and n are the number of columns.Input − int numbers = 6Output −Count of matrices of different orders that can be formed with the given number of elements are: 4Explanation − we are given with the total number of elements that a matrix of any order can contain which is 6. So the possible matrix order with ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
555 Views
We are given an array of integer type elements and a matrix or 2-D array of given row and column size and the task is to calculate the count of elements of an array that are present in each row of a matrix.Input int arr = { 2, 4, 6} and int matrix[row][col] = { { 2, 4, 6 }, {3, 4, 6}, {6, 2, 1}}Output Elements of array in row 1 are: 3 Elements of array in row 2 are: 2 Elements of array in row 3 are: 2Explanation we are having array containing 2, 4 and 6 as elements and now ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
88 Views
We are given with two linked lists and the task is to form the pairs using the integer elements of linked lists such that their product is equal to a given value which is let’s say, k. A linked list is a sequence of data structures, which are connected together via links.Input vector v_1 = {5, 7, 8, 10, 11}, . vector v_2 = {6, 4, 3, 2, 0} , int k = 20Output Count of pairs from two linked lists whose product is equal to a given value k are: 2Explanation The pairs which can be formed using the given linked lists ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
136 Views
We are given with two linked lists and the task is to form the pairs using the integer elements of linked lists such that their sum is equal to a given value which is let’s say, k. A linked list is a sequence of data structures, which are connected together via links.Input vector v_1 = {5, 7, 8, 10, 11}, . vector v_2 = {6, 4, 3, 2, 0} , int k = 11Output Count of pairs from two linked lists whose sum is equal to a given value k are: 4Explanation The pairs which can be formed using the given linked lists ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
184 Views
We are given a sorted array of integer type elements and an integer variable x and the task is to form the pairs from the given array and calculate the product of elements in the pair and check whether the calculated product is less than k or not.Input int arr[] = {2, 7, 1, 0, 8}, int k = 10Output Count of pairs in a sorted array whose product is less than k are: 7Explanation The pairs that can be formed from the given array are: (2, 7) = 14(greater than k), (2, 1) = 2(less than k), (2, 0) = 0(less than ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
527 Views
We are given a sorted array of integer type elements and an integer variable x and the task is to form the pairs from the given array and calculate the sum of elements in the pair and check whether the calculated sum is less than x or not.Input − int arr[] = {2, 7, 1, 0, 8}, int x = 8Output − Count of pairs in a sorted array whose sum is less than x are − 4Explanation − The pairs that can be formed from the given array are: (2, 7) = 9(greater than x), (2, 1) = 3(less ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
174 Views
We are given an array of integer type elements and the task is to form the pairs from the given array and calculate the set bits of elements in the pair and check whether both the elements are having equal number of set bits or not.Set bits in a binary number is represented by 1. Whenever we calculate the binary number of an integer value then it is formed as the combination of 0’s and 1’s. So, the digit 1 is known as set bit in the terms of the computer.Input int arr[] = {6, 5, 1, 3, 7}Output Count of pairs ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
2K+ Views
We are given an array of integer type elements and the task is to form the pairs from the given array and calculate the sum of elements in the pair and check whether the given sum is divisible by k or not.Input − int arr[] = {4, 1, 2, 0, 2}, int k = 2Output − Count pairs in array whose sum is divisible by k are − 2Explanation − The pairs that can be formed from the given array are: (4, 1) = 5(not divisible by 2), (4, 2) = 6(divisible by 2), (4, 0) = 4(divisible by 2), ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
218 Views
We are given an array of integer type elements and the task is to form the pairs from the given array and calculate the sum of elements in the pair and check whether the given sum is divisible by 4 or not.Input − int arr[] = {4, 1, 2, 0, 2}Output − Count pairs in array whose sum is divisible by 4 are − 2Explanation − The pairs that can be formed from the given array are: (4, 1) = 5(not divisible by 4), (4, 2) = 6(not divisible by 4), (4, 0) = 4(divisible by 4), (1, 2) = ... Read More