dfs
that takes the current index i
, the total number of questions n
, the total number of students and mentors m
, the students array, the mentors array, and a reference to the maximum score ans
.i
is equal to n
, calculate the compatibility score for the current permutation and update ans
if the score is higher than the current ans
.i
to n
and swap the i-th
student with the j-th
student.dfs
recursively with the next index i + 1
.ans
to 0 and call dfs
starting from index 0.ans
.