Sunidhi Bansal has Published 1100 Articles

Count pairs in array whose sum is divisible by 4 in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2020 05:53:31

215 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, ... Read More

Count Pairs from two arrays with even sum in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:59:58

230 Views

We are given two arrays of integer type elements let’s say, arr_1[] and arr_2[] and the task is to pick one element from arr_1[] and another element from arr_[] to form a pair then calculate the sum of elements in the pair and check whether the resultant sum is even ... Read More

Count pairs whose products exist in array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 05:58:02

95 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 product of elements in the pair and check whether the given product is present in the given array or not.Input − int arr[] = {6, 2, ... Read More

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

321 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

565 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

178 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

320 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

116 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

114 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

377 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

Advertisements