A Function to find the string having the minimum length and returns that length
static int findMinLength ( string [ ] arr , int n ) { int min = int . MaxValue ; for ( int i = 0 ; i <= ( n - 1 ) ; i ++ ) { if ( arr [ i ] . Length < min ) { min = arr [ i ] . Length ; } } return min ; } static bool allContainsPrefix ( string [ ] arr , int n , string str , int start , int end ) { for ( int i = 0 ; i <= ( n - 1 ) ; i ++ ) { string arr_i = arr [ i ] ; for ( int j = start ; j <= end ; j ++ ) if ( arr_i [ j ] != str [ j ] ) return false ; } return true ; }