title: Given a set of rectangles, find 3 bounding rectangles with the smallest area
body: <p>I am trying to implement redraw regions with up to 3 regions but can't think of an efficient way to find the best set of regions given a set of rectangles.</p>
  
  <p>So there would be a set of rectangles and I would need to calculate up to 3 bounding rectangles that produce the smallest area.
  <img src="https://i.stack.imgur.com/vNkmU.png" alt="bounding rects"></p>
  
  <p>The black rectangles are the set of rectangles whereas the red rectangles are the bounding boxes (up to 3) that produce the smallest possible area. Need to work out the best possible combination of bounding boxes.</p>