- 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)
262 Views
Given a 2D array arr[][] containing intervals and a number ‘value’. The goal is to find the number of intervals present in arr between which value lies. For example intervals are [ [1, 5], [3, 7] ] and value=4 then it lies in both these intervals and count would be 2.For ExampleInputarr[4][2] = { { 1, 20 }, { 12, 25 }, { 32, 40 }, { 15, 18 } } value=16OutputCount of number of intervals in which a given value lies are: 3ExplanationThe value 16 lies between 1−20, 12−25 and 15−18Inputarr[4][2] = {{ 1, 20 }, { 20, 30 ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
184 Views
Given an integer N as input. The goal is to find the count of integers that are less than N and represented in Binary form. For example if input N is 12 then numbers less than 12 are 1, 10, 11 that are binary and contain 0s and 1s as digits. The answer would be 3.For ExampleInputN=100OutputCount of Binary Digit numbers smaller than N are − 4ExplanationThe Binary numbers less than 100 are − 1, 10, 11, 100InputN=120OutputCount of Binary Digit numbers smaller than N are: 7ExplanationThe Binary numbers less than 100 are : 1, 10, 11, 100, 101, 110, ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
343 Views
Given two integers named ‘one’ and ‘another’. The goal is to find the number of possible arrays such that −The elements in the array are in range between 1 and ‘another’.All elements of array are such that arr[i] divides arr[i+1] or arr[i+1] divides arr[i+2]....and so on.The length of the array is ‘one’.For ExampleInputone = 3, another = 2OutputCount of arrays in which all adjacent elements are such that one of them divide the another are: 8ExplanationThe arrays will be: [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 2, 1 ], [ 1, 2, 2 ], [ ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
90 Views
Given a number N as input. The goal is to find the count of all N digit numbers that have sum Count of all N digit numbers such that num + Rev(num) = 10N − 1num+rev(num)=10N−1For ExampleInputN=4OutputCount of all N digit numbers such that num + Rev(num) = 10N − 1 are − 90ExplanationThe numbers would be − 1. 1188 + 8811 = 9999 2. 2277 + 7722 = 9999 3. 1278 + 8721 = 9999 ……...total 90 numbersInputN=5OutputCount of all N digit numbers such that num + Rev(num) = 10N − 1 are − 0ExplanationAs N is odd, ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
160 Views
Given two integers A and B and a number X. The goal is to find the count of values that X can have so that A%X=B. For the above equation if, A==B then infinite values of X are possible, so return −1. If A < B then there would be no solution so return 0. If A>B then return count of divisors of (AB) as result.For ExampleInputA=5, B=2OutputCount of all possible values of X such that A % X = B are: 1Explanation5%3=2. So X is 3 here.InputA=10, B=10OutputCount of all possible values of X such that A % X ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
533 Views
Given an array of numbers and a stack. All the elements of the array are present inside the stack The goal is to find the count of pop operations required for getting individual array elements.The stack is filled in decreasing order, the first element is highest and top element is lowest.For ExampleInputStack [ 7, 6, 2, 1 ] array : 2, 1, 6, 7OutputCount of number of pop operations on stack to get each element of the array are: 3 1 0 0ExplanationTraversing array from 0th index, To get 2 we will pop stack three times. So arr[0] is 3. ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
98 Views
Given two integers N and K, the goal is to find the count of numbers such that they follow below conditions −Number=K Where count is the number of prime numbers less than or equal to Number.For ExampleInputN = 5, K = 2OutputCount of numbers < = N whose difference with the count of primes upto them is > = K are: 2ExplanationThe numbers that follow the conditions are: 5 ( 5−2>=2 ) and 4 ( 4−2>=2 )InputN = 10, K = 6OutputCount of numbers < = N whose difference with the count of primes upto them is > = K ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
446 Views
Given two numbers e and p. The goal is to count the number of ways in which we can divide e elements of a set into p partitions/subsets.For ExampleInpute=4 p=2OutputCount of number of ways to partition a set into k subsets are: 7ExplanationIf elements are: a b c d then ways to divide them into 2 partitions are: (a, b, c)−(d), (a, b)−(c, d), (a, b, c)−(d), (a)−(b, c, d), (a, c)−(b, d), (a, c, d)−(b), (a, b, d)−(c). Total 7 ways.Inpute=2 p=2OutputCount of number of ways to partition a set into k subsets are: 1ExplanationIf elements are: a b ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
246 Views
Given an array of positive numbers. Each element represents the maximum number of jumps that can be made from that index to reach the end of the array. The goal is to find the number of jumps that can be made from that element to reach the end. If arr[] is [ 1, 2, 3 ] then for 1 jumps can be 1, for 2 jumps can be 1 or 2 and for 3 jumps can be made 1, 2 or 3.For ExampleInputarr[] = {1, 2, 3}OutputCount of number of ways to jump to reach end are: 1 1 0ExplanationFor ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
4K+ Views
Given an integer num as input. The goal is to find the number of trailing zeroes in the binary representation of num using bitset.A bitset stores the bits 0s and 1s in it. It is an array of bits.For ExampleInputnum = 10OutputCount of number of trailing zeros in Binary representation of a number using Bitset are: 1ExplanationThe number 10 in binary is represented as 1010 so trailing zeroes in it is 1.Inputnum = 64OutputCount of number of trailing zeros in Binary representation of a number using Bitset are: 6ExplanationThe number 64 in binary is represented as 10000000 so trailing zeroes ... Read More