Sunidhi Bansal has Published 1085 Articles

Count numbers which are divisible by all the numbers from 2 to 10 in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:55:38

425 Views

We are given a number let’s say, num and the task is to calculate the count of numbers in the range 1 to num that are divisible by 2, 3, 4, 5, 6, 7, 8, 9 and 10.Input − int num = 10000Output − Count numbers which are divisible by ... Read More

Count unset bits of a number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:52:23

788 Views

We are given an integer number let’s say, num and the task is to firstly calculate the binary digit of a number and then calculate the total unset bits of a number.Unset bits in a binary number is represented by 0. Whenever we calculate the binary number of an integer ... Read More

Count unset bits in a range in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:49:42

273 Views

We are given an integer number let’s say, num and the range with left and right values. The task is to firstly calculate the binary digit of a number and then set the loop from the left digit till the right digit and then in the given range calculate the ... Read More

Count of lines required to write the given String in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:47:38

485 Views

We are given a string Str of alphabets and an array widths[]containing width of all English alphabets. The goal is to find the number of lines required to print this string on a page which has a width of 10 characters. Also print remaining characters.We will traverse the string check ... Read More

Count of distinct sums that can be obtained by adding prime numbers from given arrays in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:44:50

192 Views

We are given two arrays containing prime and non prime numbers. The goal is to find the count of distinct sums of pairs of prime numbers in each array.We will do this by making a pair of two primes from each array, take their sum and add them to set ... Read More

Count ways to spell a number with repeated digits in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:42:33

210 Views

We are given a number containing many repeated digits as a string. The goal is to find the number of ways to spell it. For example 112233 can be spelled as double one, double two double three or one one two two three three.We will do this by checking continuous ... Read More

Count ways to reach the nth stair using step 1, 2 or 3 in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:40:34

563 Views

We are given a total number of steps in a staircase that is n. A person can reach the next floor by skipping 1, 2 or 3 steps at a time. The goal is to find the number of ways in which the next floor can be reached by doing ... Read More

Count triplet pairs (A, B, C) of points in 2-D space that satisfy the given condition in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:38:48

322 Views

We are given an input of N points on a 2-D space. The goal is to find the count of triplets of points from the input such that one point is the mid-point on the line between the other two. i.e if triplet is (A, B, C) then B is ... Read More

Count numbers have all 1s together in binary representation in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:37:01

479 Views

We are given a positive integer N. The goal is to count the numbers less than or equal to N that have all 1’s in their binary representation. For example 1 is 1, 3 is 11, 7 is 111, 15 is 1111... so on.If we see the numbers then all ... Read More

Count numbers which can be represented as sum of same parity primes in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:35:38

192 Views

We are given an array Arr[] of positive integers of size N. The goal is to count the number of elements in that array which can be represented as sum of parity primes, that is they can be shown as a sum of the same prime number. Ex; 4= 2+2, ... Read More

Advertisements