Skip to content

Latest commit

 

History

History
54 lines (32 loc) · 847 Bytes

File metadata and controls

54 lines (32 loc) · 847 Bytes

中文文档

Description

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 <= 2 * 109

Solutions

Python3

Java

...