handling case where max and min are the same