• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
December 07, 2023 |1.3K Views
PROBLEM OF THE DAY : 06/12/2023 | How Many X's?
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Maths but also build up problem-solving skills.

In this problem, we are given,  two integers L, R, and digit X. Find the number of occurrences of X in all the numbers in the range (L, R) excluding L and R.

Example :

Input:
L=10, R=19, X=1
Output:
9

Explanation:
There are 9 1s (11, 12, 13, 14, 15, 16, 17, 18) in the numbers in the range (10,19).

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/how-many-xs4514/1