MinPerimeterRectangle solution