Find the smallest positive number which can not be represented by given digits | Function to find the smallest positive number which can not be represented by given digits ; Storing the count of 0 digit or store the value at 0 th index ; Calculates the min value in the array starting from 1 st index and also store its index . ; If its value at 0 th index is less than min value than either 10 , 100 , 1000 ... can 't be expressed ; If its value is greater than min value then iterate the loop upto first min value index and simply print its index value . ; Driver code ; Value of N is always 10 as we take digit from 0 to 9 ; Calling function
def expressDigit ( arr , n ) : NEW_LINE INDENT min = 9 NEW_LINE index = 0 NEW_LINE temp = 0 NEW_LINE temp = arr [ 0 ] NEW_LINE for i in range ( 1 , 10 ) : NEW_LINE INDENT if ( arr [ i ] < min ) : NEW_LINE INDENT min = arr [ i ] NEW_LINE index = i NEW_LINE DEDENT DEDENT if ( temp < min ) : NEW_LINE INDENT print ( 1 , end = " " ) NEW_LINE for i in range ( 1 , temp + 1 ) : NEW_LINE INDENT print ( 0 , end = " " ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i in range ( min ) : NEW_LINE INDENT print ( index , end = " " ) NEW_LINE DEDENT print ( index ) NEW_LINE DEDENT DEDENT arr = [ 2 , 2 , 1 , 2 , 1 , 1 , 3 , 1 , 1 , 1 ] NEW_LINE N = 10 NEW_LINE expressDigit ( arr , N ) NEW_LINE