Minimum Deci | Function to find the count of minimum Deci - Binary numbers required to obtain S ; Stores the minimum count ; Iterate over the string s ; Convert the char to its equivalent integer ; If current character is the maximum so far ; Update the maximum digit ; Prthe required result ; Driver Code
def minimum_deci_binary_number ( s ) : NEW_LINE INDENT m = - 10 ** 19 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT temp = ord ( s [ i ] ) - ord ( '0' ) NEW_LINE if ( temp > m ) : NEW_LINE INDENT m = temp NEW_LINE DEDENT DEDENT return m NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT S = "31" NEW_LINE print ( minimum_deci_binary_number ( S ) ) NEW_LINE DEDENT