LeetCode Question · Jun 2021

Bloomberg Phone Interview

4 upvotes 1,077 views 4 replies

Question Details

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...

Full Details

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

About This Question

This is a reported interview question from a bloomberg interview for a swe role during the phone screen round reported in 2021.

It covers the following topics: Strings .

Topics