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.
Assume z is a descedant of x, then y need to satisfy two conditions:
- xdong0214 January 23, 2011(1) y need to be ancester of z
(2) y need to be descendant of x
Do breadth first search (level order traversal) from the root, set one field (named as nf) in a newly found node as n to indicate this node is the nth node found in the BFS.
After BFS, if z.nf>y.nf>z.nf. O(V+E)
When implementation of BFS, we need to let the nf field of nodes belonging to the same level to be equal. As a result, we need to monitor the number of children when enqueue a node, which is the only tricky part of this problem.