Approach hintTry it first, then revealHide
Sort exams by the scheduled date a, breaking ties by b. Keep the current day and take each exam on day b if that is not earlier than the current day, otherwise on day a.
Sort exams by the scheduled date a, breaking ties by b. Keep the current day and take each exam on day b if that is not earlier than the current day, otherwise on day a.