text: Check if the minute value is valid , if not valid then skip the current iteration , to check ' minute ' value flag is set to 0.
code: if ( ! isValid ( m1 + '0' , m2 + '0' , str , 0 ) ) { continue ; } if ( inRange ( i , j , L , R ) ) { displayTime ( i , j ) ; return ; } } } if ( inRange ( i , j , L , R ) ) displayTime ( i , j ) ; else cout << " - 1" << endl ; }