Google interview question

Stable matching problem modified for students and courses.