Question: Mathematical Calculations: Interesting numbers An integer is said to be interesting if the following two conditions hold true after removing all leading zeros from it:

Mathematical Calculations: Interesting numbers
An integer is said to be interesting if the following two conditions hold true after removing all leading zeros from it:
The count of odd digits is even.
The count of even digits is odd.
You are given two integers, Land R.
Write a program to find the count of interesting numbers in the range [L, R)(L and R inclusive).
Example
Number 455 is an interesting integer as:
The count of odd digits is 2(5,5)
The count of even digits is 1(4)
Function Description
In the provided code snippet, implement the provided interesting Digits (...) method using the variables to print a single integer denoting the number of interesting numbers between Land R. You can write your code in the space below
the phrase "WRITE YOUR LOGIC HERE".
There will be multiple test cases running so the Input and Output should match exactly as provided.
The base output variable result is set to a default value of -484 which can be modified. Additionally, you can add or remove these output variables.
Input Format
The first line of input contains 2 space-separated integers L and R.
Sample Input
19
denotes L & R separated by a space
Constraints
1<= L <= R <=1018
Output Format
The output contains a single integer denoting the number of interesting numbers between Land R.
Sample Output
4
Explanation
The interesting numbers between Land R.(L and R inclusive)
are:
2,4,6,8 as they appear 1(i.e., odd number of times) time and are themselves an even number.
Hence, the output is 4.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!