CapitalIQ Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

If p!=q, reduce to LCA problem
If p==q, DFS to find the parent of p

- Anonymous September 27, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

even in case of p==q its same as the lca

- cunomad September 27, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

in both the cases => LCA problem

- klpd September 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what does LCA means

- Anonymous August 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

LCA means Least Common Ancestor

- Ravi Lohia September 10, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

does anyone knw the questions for technology Quality Analyst....i need dem vry urgent..plz tell asap....

- anonymous December 14, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

suggest algo 4 lca

- pranav May 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

tree *least(tree *node,int val1,int val2)
{
tree *current=node;
while(1)
{
if(current->data<val1&&current->data<val2)
{
if(current->right->data==val1||current->right->data==val2)
return current;
else
current=current->right;
}
else if(current->data>val1&&current->data>val2)
{
if(current->left->data==val1||current->left->data==val2)
return current;
else
current=current->left;
}
else
return current;
}
}

- laasya1991 October 13, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@laasya1991
i think this code works only for binary search tree, and what if one value is present and one is not in our tree?

- pavan July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Btree* least(Btree *b ,int k1,int k2)
{
if(contains(b->lc,k1)&&contains(b->rc,k2) || contains(b->lc,k2)&&contains(b->rc,k1))
{
return b;
}
else if(contains(b->lc,k1)&&contains(b->lc,k2))
return least(b->lc,k1,k2);
else
return least(b->rc,k1,k2);
}

bool contains(Btree *bt,int k)
/* level order traversal to find whether node containing value k is present or not */
{
arrayQueue <Btree *> q; //queue of binary tree nodes
while(bt!=NULL)
{
if(bt->d==k)
return true;
//put bt's child on queue
if(bt->lc!=NULL)
q.push(bt->lc);
if(bt->rc!=NULL)
q.push(bt->rc);
//get next node to visit
try{
bt=q.front();
}
catch(queueEmpty){
return false;
}
q.pop();
}

}

- santosh July 20, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More