1
classId | studentId
  0          0
  0          1
  0          2
  1          0
  1          1
  1          2
  2          2

How do you find the pairs of students (s1, s2) that ONLY have classes with each other? So if student1 has a class, student2 HAS to be in that class to and vice versa.

I know you have to pair them together by classId but how do you eliminate false positives e.g. studentId =2 in this case?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.