Solution for MinPerimeterRectangle