/**
* # Step 1
* Throughout this interview, we'll pretend we're building a new analytical
* database. Don't worry about actually building a database though -- these will
* all be toy problems.
*
* Here's how the database works: all records are represented as maps, with string
* keys and integer values. The records are contained in an array, in no
* particular order.
*
* To begin with, the database will support just one function: min_by_key. This
* function scans the array of records and returns the record that has the minimum
* value for a specified key. Records that do not contain the specified key are
* considered to have value 0 for the key. Note that keys may map to negative values!
*
* Here's an example use case: each of your records contains data about a school
* student. You can use min_by_key to answer questions such as "who is the youngest
* student?" and "who is the student with the lowest grade-point average?"
*
* Implementation notes:
* * You should handle an empty array of records in an idiomatic way in your
* language of choice.
* * If several records share the same minimum value for the chosen key, you
* may return any of them.
*
/**
* # Step 2
* Our next step in database development is to add a new function. We'll call this
* function first_by_key. It has much in common with min_by_key. first_by_key
* takes three arguments:
*
* 1. a string key
* 2. a string sort direction (which must be either "asc" or "desc")
* 3. an array of records, just as in min_by_key.
*
* If the sort direction is "asc", then we should return the minimum record,
* otherwise we should return the maximum record. As before, records without a
* value for the key should be treated as having value 0.
*
* Once you have a working solution, you should re-implement min_by_key in terms
* of first_by_key .
*
/**
* # Step 3
* As we build increasingly rich orderings for our records, we'll find it useful
* to extract the comparison of records into a comparator. This is a function or
* object (depending on your language) which determines if a record is
* "less than", equal, or "greater than" another.
*
* In object-oriented languages, you should write a class whose constructor
* accepts two parameters: a string key and a string direction. The class should
* implement a method compare that takes as its parameters two records. This
* method should return -1 if the first record comes before the second record
* (according to key and direction), zero if neither record comes before the
* other, or 1 if the first record comes after the second.
*
* In functional languages, you should write a function which accepts two
* parameters: a string key and a string direction. The function should return
* a function that takes as its parameters two records. This function should return
* -1 if the first record comes before the second record (according to key and
* direction), zero if neither record comes before the other, or 1 if the first
* record comes after the second.
*
* You should then use your comparator in your implementation of first_by_key.
*