def greedy_largest_compatible_subset(requests):
  """
  Given requests for a single resource
  and a list of requests

  We want to find the largest subset
  of compatible requests

  A request is compatible if
  r1.finish <= r2.start or r1.start >= r2.finish

  Greedy algorithm:
  - Sort the array by finish time
  - Pick request with earliest finish time, r
  - Add r to the result
  - Iterate over the array until you reach
    the next compatible result

  requests: List[int]
  start: Dict[int]int
  finish: Dict[int]int

  Complexity: O(n * log(n))

  """
  result = []
  i = 0
  requests.sort(key=lambda r: r.finish)
  n = len(requests)
  while i < n:
    best = requests[i]
    result.append(best)
    while i < n and \
      not requests[i].is_compatible(best):
        i += 1
  return result