min, max 1d and 2d