Google Interview Question for Java Developers
- 0of 0 votes
The topic is to design a data structure to store employee relationships.- ajay.raj December 01, 2017 in United States
For example, A is B's direct manager, there is an operation is "" set_manager "," A "," B ">.
For example, B is a colleague of C <"set_peer", "B", "C">
At this point, we do this with <query_manager "," A "," B "> and we get True, which means that A is B's manager (either direct or indirect).
This is true if we have <"query_manager", "A", "C">, because C is a coworker for B, so A is also C's manager. That is, there is a transitive relationship between colleagues.
Follow up, such as query <"query_manager", "A", "D"> (D this person has not been initialized), what to do. Conflict how to do
For example, A is a direct manager of B, E is a direct manager of C, which is set_peer (B, C), there will be conflicts, B and C direct manager should be the same person,
E and A are two people, there are contradictions here.
| Report Duplicate | Flag | PURGE
Google Java Developer
Open Chat in New Window