human
Total no of 1 's in numbers | function to count the frequency of 1..
Driver Code"
Solution in Python:
assistant
#Here is code to total no of 1 's in numbers and the other steps required.
 def countDigitOne ( n ) :
	countr = 0 ;
	i = 1 ;
	while ( i <= n ) :
		divider = i * 10 ;
		countr += ( int ( n / divider ) * i + min ( max ( n % divider - i + 1 , 0 ) , i ) ) ;
		i *= 10 ;
	return countr ;
n = 13 ;
print ( countDigitOne ( n ) ) ;
n = 113 ;
print ( countDigitOne ( n ) ) ;
n = 205 ;
print ( countDigitOne ( n ) ) ;