is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
My python solution:
- flygan1988 August 11, 2016import sys
class GraphNode:
def __init__(self, V):
self.value = V
self.neighbors = []
def Traffic(n, node):
total = node.value
for neighbor in node.neighbors:
if neighbor == n:
continue
total += Traffic(node,neighbor)
return total
def maxTraffic(graph):
result = {}
for node in graph:
Max = -sys.maxsize
for neighbor in node.neighbors:
#total = 0
total = Traffic(node,neighbor)
Max = max(Max,total)
result[node.value] = Max
return result
if __name__ == '__main__':
gn1 = GraphNode(1)
gn2 = GraphNode(2)
gn3 = GraphNode(3)
gn4 = GraphNode(4)
gn5 = GraphNode(5)
gn7 = GraphNode(7)
gn15 = GraphNode(15)
gn1.neighbors.append(gn5)
gn2.neighbors.append(gn5)
gn2.neighbors.append(gn7)
gn2.neighbors.append(gn15)
gn3.neighbors.append(gn5)
gn4.neighbors.append(gn5)
gn5.neighbors.append(gn1)
gn5.neighbors.append(gn2)
gn5.neighbors.append(gn3)
gn5.neighbors.append(gn4)
gn7.neighbors.append(gn2)
gn15.neighbors.append(gn2)
graph = []
graph.append(gn1)
graph.append(gn2)
graph.append(gn3)
graph.append(gn4)
graph.append(gn5)
graph.append(gn7)
graph.append(gn15)
print(maxTraffic(graph))