My Background - 16 years of programming experience, includes 9 years specializing in Android, seeking potentially E6 roles.
Given information about the links between various data centers, find the groups of isolated but connected data centers. For example --> Input : {A<->B, B<->C, D<->E}, Output : {A, B, C}, {D, E}
Clarifying questions -
Of course, I was familiar with BFS and DFS to some degree, but not a whole lot in Graphs.
My first though about the solution was -
class Node {
Character value; // representing each character.
List<Node> edges = new ArrayList<>(); // representing it's connections.
}Therefore, method signature was -
public Set<Set<Node>> disjointSets(List<Node> input);Then I went ahead and implemented a naive DFS, something like backtracking, that appears to have solved the problem.
Biggest issue - no compiler. This is entirely plain text-editor, and I was expected to walk-through the solution conceptually. My solution did seem to work correctly. Only I noticed the glaring recursive stack-overflow issue, but never mentioned that.
Follow-up:
Apparently, Input : {A<->B, B<->C, D<->E, E <-> A}, Output : {A, B, C}, {D, E}.
Threw me off-guard, because based on my signature and DFS, output is the universal set.
I'd imagine, the interviewer's expected output is based on an Adjacency-Matrix. As you may notice, E <--> A probably has no significance ?

I did not know LC-323 previously.
Although, after noticing LC-323, I have more questions, based of some clarifying questions that I had discussed with the interviewer.
In all, did the interviewer ask a bad / incomplete question ? Why do they ask bad questions ?
Was I expected / supposed to correct the interviewer ? Suggest correct inputs, input-types etc ?
Should i have practiced LC-323 previously, and recalled exactly how this interview question is possibly incomplete ?
I reached out to the recruiter regarding the interviewer's conflicting points-of-view, see clarifying question-2, and follow-up output, that my DFS approach apparently failed in the interviewer's expected output. I will have to do another phone-screen round. If it is going to be just as hard, is it all worth it ?
Edit - Upon popular demand in the discussions below, I've included a potential Adjacency-matrix, that might explain the follow-up expected output. Please bear in mind, this is only based of my understanding of the problem, the clarifying questions, potential solution approaches etc. I do not know what was going-on in the interviewer's mind. I cannot guess that.