You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnself.countDigitOne(base -1) + lows +1+self.countDigitOne(lows) if high ==1else high *self.countDigitOne(base -1) + base +self.countDigitOne(lows)
38
64
```
39
65
40
66
### Java
41
67
<!-- 这里可写当前语言的特殊实现逻辑 -->
42
68
43
69
```java
44
-
70
+
classSolution {
71
+
publicintcountDigitOne(intn) {
72
+
if (n <1) {
73
+
return0;
74
+
}
75
+
String s =String.valueOf(n);
76
+
int high = s.charAt(0) -'0'; // 最高位
77
+
int base = (int) Math.pow(10, s.length() -1); // 基数
0 commit comments