Given two number l and r. Count the total numbers between l and r which when subtracted from their respective reverse, the difference is a product of k.
Input : 20 23 6 Output : 2 20 and 22 are the two numbers. |20-2| = 18 which is a product of 6 |22-22| = 0 which is a product of 6 Input : 35 45 5 Output : 2 38 and 44 are the two numbers. |38-83| = 45 which is a product of 5 |44-44| = 0 which is a product of 5
Approach: For each number between the given range check if the difference between the number and its reverse number is divisible by k, increment count if yes.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Counting numbers of n digits that are monotone
- First string from the given array whose reverse is also present in the same array
- Check if the product of digit sum and its reverse equals the number or not
- Program to print numbers from N to 1 in reverse order
- Find N numbers such that a number and its reverse are divisible by sum of its digits
- Count of n digit numbers whose sum of digits equals to given sum
- Print all n-digit numbers whose sum of digits equals to given sum
- Count natural numbers whose all permutation are greater than that number
- Count of numbers whose sum of increasing powers of digits is equal to the number itself
- Count all prime numbers in a given range whose sum of digits is also prime
- Find two numbers whose sum is N and does not contain any digit as K
- Count of N digit Numbers whose sum of every K consecutive digits is equal
- Count of N digit Numbers whose sum of every K consecutive digits is equal | Set 2
- Count all N digit numbers whose digits are multiple of X
- First digit in product of an array of numbers
- Number of digits in the product of two numbers
- Find last k digits in product of an array numbers
- Find the maximum sum of digits of the product of two numbers
- Largest palindrome which is product of two N-digit numbers : Set 2
- Cumulative product of digits of all numbers in the given range
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Mithun Kumar