Bloomberg LP Interview Question for Financial Software Developers






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

list *findX(list *root, int N, int X) {

int cnt=1;
// Assign start to root.
list *start=root;
list *node=root;

// Assuming that lenght is N and X < N, root will not be NULL
while(cnt++ < X) start=start->next;

while(start) {
start=start->next;
node=node->next;
}

// now node will be pointing to X the node
return node;
}

- ked February 26, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

And complexity of above function is O(n).

- ked February 26, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Correct me if i'm wrong but since we'r trying to find the element thats X from the end, wont we use N-X in the while loop?
while (c++< (N-X))
and i'm assuming that that while loop encompasses the following while(start) in its loop?

- Ronin February 27, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

correct ronin, the original code was wrong. just replace the running var to N-X then it will work.

- wcmaness April 08, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Above solution is correct, Just trying different ways of doing a given problem

NODE FindK(NODE node,int k)
{
static int i;
if(NULL == node)
.....return NULL;
FindK(node->next,k);
if(k-1 == i)
.....return node;
i++;
return NULL;
}

- YetAnotherCoder September 30, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

There is no way to get it -- linked list and from the end? End-->next is always NULL?

- fakong December 06, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

2 cases :
if lenght N is given as in q above :

struct node*ptr=head;
int c=0;

while(c++<N-X)
{
if(ptr->next==NULL)return NOT FOUND;

ptr=ptr->next;
}

return ptr;



if N is not given we use 2 ptrs.

struct node* ptr=head;
struct node* retv=head;
int c=0;
while(c++<X)
ptr=ptr->next;

while(ptr->next!=NULL)
{
ptr=ptr->next;
retv=retv->next;

}

return retv;

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

This should how much legacy code bloomturd has.

- Anonymous May 27, 2010 | 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