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.
I simply used BFS and checked if the value of the node I was visiting at that moment existed in the list of Nodes left to visit.
This scenario occurs when a triangle is present because of the following:
Suppose nodes 1, 2, and 3 are connected to each other. Start at node 1.
- Node 1 is visited, adding 2 and 3 to the list of nodes to visit.
- Node 1 is marked as visited.
- Node 2 is visited, adding 3 to the list of nodes to visit (only add nodes that have not been visited, so node 1 is skipped).
- Node 3 is visited, node 3 observes that it is still on the list of nodes to visit. Mark 3 as visited and incrementing triangles count. Also remove the duplicate node 3 entry from the to visit list.
Code:
Complexity is O(n^2) as each node must check the list of nodes yet to visit.
- bippybibimbap April 17, 2014