Minimum Deci | C # program to implement the above approach ; 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 ; Print the required result ; Driver Code
using System ; class GFG { static int minimum_deci_binary_number ( string s ) { int m = int . MinValue ; for ( int i = 0 ; i < s . Length ; i ++ ) { int temp = s [ i ] - '0' ; if ( temp > m ) { m = temp ; } } return m ; } public static void Main ( String [ ] args ) { string S = "31" ; Console . WriteLine ( minimum_deci_binary_number ( S ) ) ; } }