Given an integer num, the task is to count the number of holes in that number. The holes in each digit are given below:
|Digit||Number of Holes|
Input: num = 6457819
Input: num = 2537312
Approach: Initialize holes = 0 and an array hole with the values given where hole[i] stores the number of holes in the digit i. Now, for every digit d in num update holes = holes + hole[d]. Print the holes in the end.
Below is the implementation of the above approach:
- Count even and odd digits in an Integer
- Program to count digits in an integer (4 Different Methods)
- Minimum positive integer to divide a number such that the result is an odd
- Find smallest possible Number from a given large Number with same count of digits
- Count Number of animals in a zoo from given number of head and legs
- Find count of digits in a number that divide the number
- Count of prime digits of a Number which divides the number
- Count the number of occurrences of a particular digit in a number
- Count Hexadecimal Number
- Count digits in given number N which divide N
- Count number of even and odd elements in an array
- Count total number of digits from 1 to n
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count the total number of triangles after Nth operation
- Count the number of elements in an array which are divisible by k
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.