title: How to algorithmically find the biggest rectangle that can fit in a space with other rectangles?
body: <p>So I have a rectangle that is <code>6m x 2.25m</code> and I have 4 other rectangles with static dimensions but are randomly placed inside the global rectangle.</p>
  
  <p>I need to have a function that will calculate the area of the largest rectangle that can fit in the outer rectangle that also won't overlap with the other rectangles.</p>
  
  <p>I thought about finding the maximum x distance between the small rects but depending if they're oriented landscape or portrait, x might not do the job. At this point I'm rather stuck and I can't find much online about doing this, but I'm sure this is quite an ordinary task for experienced coders.</p>
  
  <p>Update:
  Here an example image to show what I'm trying to describe. The colored rectangles are randomly placed with static dimensions, and I want to find the largest rectangle that can fit.</p>
  
  <p><a href="https://i.stack.imgur.com/s0Ujn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s0Ujn.png" alt=""></a></p>
  
  <p>Thanks for your time!</p>