As reported: Expedia Group software engineer coding challenge on HackerRank, 105 minutes (2025) — problem 3, Connected Groups.
related is an n × n matrix given as n strings of '0'/'1'. Person i knows person j when related[i][j] == '1'; the relation is symmetric, everyone knows themselves, and it is transitive (if i knows j and j knows k, then i and k are in the same group). Return the number of groups.
It is the same problem as LeetCode 547 — Number of Provinces, with the matrix given as strings.
Example 1
related = ["110", "110", "001"] -> 2
Example 2
related = ["1100", "1110", "0110", "0001"] -> 2
Example 3
related = ["10000", "01000", "00100", "00010", "00001"] -> 5
Constraints: 1 ≤ n ≤ 300; related[i][i] == '1'; related[i][j] == related[j][i].
Code runner format: one line with related as a JSON array of strings. Implement countGroups(related); the harness prints the number of groups.