human
Write me a code to smallest x such that 1 * n , 2 * n , given the following:
Smallest x such that 1 * n , 2 * n , ... x * n have all digits from 1 to 9 | Returns smallest value x such that 1 * n , 2 * n , 3 * n ... x * n have all digits from 1 to 9 at least once.
taking temporary array and variable ..
iterate till we get all the 10 digits at least once.
checking all the digits.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to smallest x such that 1 * n , 2 * n , .
 def smallestX ( n ) :
	temp = [ 0 ] * 10
	if ( n == 0 ) :
		return - 1
	count = 0
	x = 1
	while ( count < 10 ) :
		y = x * n
		while ( y > 0 ) :
			if ( temp [ y % 10 ] == 0 ) :
				count += 1
				temp [ y % 10 ] = 1
			y = int ( y / 10 )
		x += 1
	return x - 1
if __name__ == ' _ _ main _ _ ' :
	n = 5
	print ( smallestX ( n ) )