过了就行吧,
优化还没看
import java.util.*;
public class Solution {
public int NumberOf1Between1AndN_Solution(int n) {
int res = 0;
for(int i=1; i<= n; i++){
String temp = String.valueOf(i);
for(char c : temp.toCharArray()){
if(c=='1') res++;
}
}
return res;
}
}


京公网安备 11010502036488号