I. Problem
Given a random number, count how many holes in total. Note: the holes for each digits are listed below
- 0: 1hole
- 1: 0 hole
- 2: 0 hole
- 3: 0 hole
- 4: 1 hole
- 5: 0 hole
- 6: 1 hole
- 7: 0 hole
- 8: 2 holes
- 9: 1 hole
II. Solution
1 | // Test |
III. Complexity
- Time: O(n)
- Space: O(1)