Given three integer n, m and k, the task is to find the smallest integer > n such that digit m appears exactly k times in it.
Input: n = 111, m = 2, k = 2
Input: n = 111, m = 2, k = 3
Approach: Start iterating from n + 1 and for each integer i check whether it consists of digit m exactly k times. This way smallest integer > n with digit m occurring exactly k times can be found.
Below is the implementation of the above approach:
- Smallest integer with digit sum M and multiple of N
- Smallest multiple of 3 which consists of three given non-zero digits
- Largest number less than N with digit sum greater than the digit sum of N
- Convert a number of length N such that it contains any one digit at least 'K' times
- Count of Numbers in a Range where digit d occurs exactly K times
- Least Greater number with same digit sum
- Largest even digit number not greater than N
- Find Nth smallest number that is divisible by 100 exactly K times
- Count of m digit integers that are divisible by an integer n
- Biggest integer which has maximum digit sum in range from 1 to n
- Smallest integer which has n factors or more
- Smallest divisor D of N such that gcd(D, M) is greater than 1
- Smallest power of 4 greater than or equal to N
- Count numbers with difference between number and its digit sum greater than specific value
- Smallest N digit number which is a multiple of 5
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.