setu
BAN USER
- 1of 3 votes
AnswersA graph has N vertices numbered from 1 to N. We have two lists. One list M consisted of edges between vertices. The other list K consists of restricted paths. We have to add edges one by one from M and check whether the addition of the particular edge leads to a path between the restricted vertices given in K. If it creates a path, we have to discard the edge.
- setu in India
Example: N = 4; K = {(1,4)}; M = {(1, 2), (2, 3), (3, 4)}. Here, addition of edge (3, 4) will create a path between 1 and 4. Hence we discard edge (3, 4)| Report Duplicate | Flag | PURGE
Google SDE1
Assuming we have a map of (employee,Manager) as an input.
The isPeer function would be straight forward.
isManager Function would be as follows:
bool isManager(String empId, String managerId,map<String,String> mp) {
if(mp[empId] == managerId)
return true;
if(mp[empId] == NULL)
return false;
return isManager(mp[empId],managerId,mp);
}
RepClariceWright, abc at 8x8
I am a passionate and dedicated travel agent whose mission is to turn travel dreams into reality. I am crazy ...
RepI am Risk managers that advise organizations on any potential risks to the profitability, safety, security or existence of the ...
Repharrylseay, Aghori Mahakal Tantrik at ASAPInfosystemsPvtLtd
I am Harry and I live in the USA but basically I am from Bangor. I live my life very ...
Repsharoneruther, AT&T Customer service email at ABC TECH SUPPORT
I am Sharon, from Bethlehem USA. I am working as a Park naturalist in Sammy's Record Shack company. I ...
Reparlenekraft8, How to book a seat on Southwest airlines flight at Absolute Softech Ltd
I am a coding specialist from MD,USA.I’m indifferent to most items on the planet.Participated in creating ...
Yes it is!
- setu April 23, 2019