Class Solution
-
- All Implemented Interfaces:
public final class Solution233 - Number of Digit One.
Hard
Given an integer
n, count the total number of digit1appearing in all non-negative integers less than or equal ton.Example 1:
Input: n = 13
Output: 6
Example 2:
Input: n = 0
Output: 0
Constraints:
<code>0 <= n <= 10<sup>9</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegercountDigitOne(Integer n)-
-
Method Detail
-
countDigitOne
final Integer countDigitOne(Integer n)
-
-
-
-