If sum becomes more than x and length of this subarray is smaller than current smallest length , update the smallest length ( or result )
if ( $ curr_sum > $ x && ( $ end - $ start + 1 ) < $ min_len ) $ min_len = ( $ end - $ start + 1 ) ; } } return $ min_len ; }