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.
@aammgg didn't check you approach, but the idea might work. As a matter of fact using dynamic programing approach we could do less calculations, but as usual memory vs. loops... Bellow code could be optimized e.g. by removing new Stack for cases where allocation doesn't make sense etc. Please let me know your thoughts. here's my solution:
- vvlyaku February 04, 2011{{
static Stack FindPath(TreeNode root)
{
Stack stack = new Stack();
if (root != null && root.Value == 1)
{
Stack left = FindPath(root.Left);
Stack right = FindPath(root.Right);
if (left.Count > right.Count)
{
stack = left;
}
else
{
stack = right;
}
stack.Push(root);
}
return stack;
}
-- print
Stack st = FindPath(node);
while (st.Count > 0)
{
// print some name, printing 1s doesn't make sense...
Console.WriteLine(((TreeNode)st.Pop()).Name);
}
}}