I need help in figuring out solution to this.
There are students registered for courses. We need to group students based on common courses.
s1 is student1 and c1 is course1 and so on.
Example Input:
s1: c1, c2,c3
s2: c4,c2,c5
s3: c6,c7
s4: c1,c8
s5: c7,c9
s6: c10
Output : [[s1,s2,s4],[s3,s5],[s6]]
I said the input can be modified into Map<String, List<Strings>> and explained a brute force approach but was not able to figure out the best solution. Can anyone help