In this solution, we use ORDER BY and LIMIT to find the min and max values.
Part A solution:
Part B solution: