g0201_0300.s0233_number_of_digit_one.readme.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
233\. Number of Digit One
Hard
Given an integer `n`, count _the total number of digit_ `1` _appearing in all non-negative integers less than or equal to_ `n`.
**Example 1:**
**Input:** n = 13
**Output:** 6
**Example 2:**
**Input:** n = 0
**Output:** 0
**Constraints:**
* 0 <= n <= 109