min/max with own comparator