human
Minimum count of numbers required ending with 7 to sum as a given number | Function to return the count of minimum numbers ending with 7 required such that the sum of these numbers is n.
hasharr [ i ] will store the minimum numbers ending with 7 so that it sums to number ending with digit i.
Its always possible to write numbers > 69 to write as numbers ending with 7.
If the number is atleast equal to the sum of minimum numbers ending with 7.
Driver code"
Solution in Python:
assistant
#Here is code to minimum count of numbers required ending with 7 to sum as a given number and the other steps required.
 def minCount ( n ) :
	hasharr = [ 10 , 3 , 6 , 9 , 2 , 5 , 8 , 1 , 4 , 7 ]
	if ( n > 69 ) :
		return hasharr [ n % 10 ]
	else :
		if ( n >= hasharr [ n % 10 ] * 7 ) :
			return hasharr [ n % 10 ]
		else :
			return - 1
n = 38 ;
print ( minCount ( n ) )