Sunidhi Bansal has Published 1100 Articles

Count of smaller or equal elements in the sorted array in C++

Sunidhi Bansal

Sunidhi Bansal

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

969 Views

We are given an array of integers. The goal is to find the count of elements of an array which are less than or equal to the given value K.Input Arr[]= { 1, 2, 3, 14, 50, 69, 90 } K=12Output Numbers smaller or equal to K: 3Explanation Numbers 1, 2, 3 is ... Read More

Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:59:30

305 Views

We are provided two numbers START and END to define a range of numbers.The goal is to find all the numbers in the range [START, END] which have no digit as 0 and have sum of digits equal to a given number N. Also the numbers are divisible by MWe ... Read More

Count of numbers from range[L, R] whose sum of digits is Y in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:57:09

236 Views

We are provided two numbers START and END to define a range of numbers.The goal is to find all the numbers in the range [START, END] which have sum of digits equal to a given number Y.We will do this by traversing numbers from START to END and for each ... Read More

Count of common multiples of two numbers in a range in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:55:08

2K+ Views

We are given two numbers A and B. Also provided two numbers START and END to define a range of numbers. The Ath tile has paint white and Bth tile has paint black. If the tile is painted both black and white then it turns grey. The goal is to ... Read More

Count numbers with difference between number and its digit sum greater than specific value in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:53:26

475 Views

We are provided two numbers N which defines a range [1, N] and D which is a difference.The goal is to find all the numbers in the range [1, N] such that the [ number - (sum of its digits) ] > D. We will do this by traversing numbers ... Read More

Count numbers in range that are divisible by all of its non-zero digits in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:50:25

110 Views

We are provided two numbers START and END to define a range of numbers.The goal is to find all the numbers in the range [START, END] that are divisible by all of its non-zero digits . We will do this by traversing numbers from START to END and for each ... Read More

Count numbers in range 1 to N which are divisible by X but not by Y in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:47:44

530 Views

We are provided a number N. The goal is to find the numbers that are divisible by X and not by Y and are in the range [1, N].Let’s understand with examples.Input N=20 X=5 Y=20Output Numbers from 1 to N divisible by X not Y: 2Explanation Only 5 and 15 are divisible by ... Read More

Count numbers in a range that are divisible by all array elements in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:45:19

503 Views

We are provided two numbers START and END to define a range of numbers. And also an array of positive numbers Arr[]. The goal is to find all the numbers that are divisible by all elements of Arr[] and are in the range [START, END] .Method 1 ( Naive Approach ... Read More

Count numbers having 0 as a digit in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:41:17

2K+ Views

We are provided a number N. The goal is to find the numbers that have 0 as digit and are in the range [1, N].We will do this by traversing numbers from 10 to N ( no need to check from 1 to 9 ) and for each number we ... Read More

Count numbers from range whose prime factors are only 2 and 3 in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 31-Oct-2020 04:39:15

644 Views

We are provided two numbers START and END to define a range of numbers. The goal is to find the numbers that have only 2 and 3 as their prime factors and are in the range [START, END].We will do this by traversing numbers from START to END and for ... Read More

Advertisements