Tuesday, June 3, 2008

Some more C questions

Hi All,

This is good questin. It is not only a classical problem  and can be solved by any programming language. Still let us use on C to do so .


·  Given two sorted arrays A and B.

  1. Find the intersection of these arrays A and B.




It seems it was asked in one of Google interviews. I keep hearing from a lot of sources.


Also, I found the following strategic question

Try and find out the point where a loop starts in a linked list. This is particularly tough.  You can definitely tell, that a linked list has a loop, by using two pointers , where one travels one link and the other travels two links at a time.


Choose a appropriate time to stop this ( end of list is the correct answer, if you can find one !) . Also now that IPL is over you have ample time to solve this problem as to where the loop starts. So best of luck


There are similar questions like


There are two toys. Both can move left and right. Now, if they are standing on a number line, how will you find out which one is to the left of the other ( lets say you are facing them )



No comments: