Forum Posts

how to find longest chain of nodes
can anyone suggest me how can i find longest chain of nodes in an unweighted acyclic graph. It is also given that u can start from any node.

PROPTIGER member of technical staff (JAVA/Spring/Hibernate) interview questions
Please post PROPTIGER member of technical staff (JAVA/Spring/Hibernate) interview questions ?

Amazon SDE III expectations
Hi
Does anybody know what are the expectations for an SDE III role at Amazon and in particular what are the design skills expected during an interview for SDE III. 
Hello All
I am planning to shift my Job in India (In companies like linkedIn, FlipKart, Snapdeal ,Amazon,WalMart , Microsoft.
I am 12 years experience in C++ Algorithms and DataStructures . I am average in Algos. The time period I have thought I should give the interviews by next month So Can some one tell me the best strategy to prepare for the job change . 
effective parallelisation bilinear interpolation using OpenMP
I want to parallelise bilinear interpolation using OpenMP in such a way that there should be least memory access of input array. In the code below, for each iteration of i and j in output array, input data according to longitude and latitude values are read and processed.
input[20][20]  input array that contains data values eg{1,2,3,..,400} in 2d
lon[100][100]  longitudinal positions of each interpolation point in output array in horizontal axis not necessarily equidistant. eg. {2.34,2.65,2.74... }
lat[100][100]  latitudinal positions of each interpolation point in output array in vertical axis not necessarily equidistant.eg. {5.76,5.92,6.26... }
output[100][100]  array containing interpolated values
void interpolate(float (*lon)[100] ,float (*lat)[100] , float (*input)[100],float (*output)[100]) {
int i,j,floori,floorj;
float fractionj,fractioni;
for(j = 0; j < 100; j++)
{
for(i = 0; i < 100; i++)
{
floori = lon[i][j];
fractioni = lon[i][j]  floori;
floorj = lat[i][j];
fractionj = lat[i][j]  floorj;
output[i][j] = (1.0fractioni)*(1.0fractionj)*input[floori][floorj] + fractioni*(1.0fractionj)*input[floori+1][floorj] + (1.0fractioni)*fractionj*input[floori][floorj+1] + fractioni * fractionj *input[floori+1][floorj+1];
}
}
}
I need to divide the work in such a way that for all the interpolation points specified using lon and lat values within block of input[floori][floorj],input[floori+1][floorj],input[floori][floorj+1],input[floori+1][floorj+1] should go to one thread so that input values are read only once from memory to register for each thread. 
effective parallelisation bilinear interpolation using OpenMP
I want to parallelise bilinear interpolation using OpenMP in such a way that there should be least memory access of input array. In the code below, for each iteration of i and j in output array, input data according to longitude and latitude values are read and processed.
input[20][20]  input array that contains data values eg{1,2,3,..,400} in 2d
lon[100][100]  longitudinal positions of each interpolation point in output array in horizontal axis not necessarily equidistant. eg. {2.34,2.65,2.74... }
lat[100][100]  latitudinal positions of each interpolation point in output array in vertical axis not necessarily equidistant.eg. {5.76,5.92,6.26... }
output[100][100]  array containing interpolated values
void interpolate(float (*lon)[100] ,float (*lat)[100] , float (*input)[100],float (*output)[100]) {
int i,j,floori,floorj;
float fractionj,fractioni;
for(j = 0; j < 100; j++)
{
for(i = 0; i < 100; i++)
{
floori = lon[i][j];
fractioni = lon[i][j]  floori;
floorj = lat[i][j];
fractionj = lat[i][j]  floorj;
output[i][j] = (1.0fractioni)*(1.0fractionj)*input[floori][floorj] + fractioni*(1.0fractionj)*input[floori+1][floorj] + (1.0fractioni)*fractionj*input[floori][floorj+1] + fractioni * fractionj *input[floori+1][floorj+1];
}
}
}
I need to divide the work in such a way that for all the interpolation points specified using lon and lat values within block of input[floori][floorj],input[floori+1][floorj],input[floori][floorj+1],input[floori+1][floorj+1] should go to one thread so that input values are read only once from memory to register for each thread. 
effective parallelisation bilinear interpolation using OpenMP
I want to parallelise bilinear interpolation using OpenMP in such a way that there should be least memory access of input array. In the code below, for each iteration of i and j, input data is read and processed.
input[20][20]  input array that contains data values {1,2,3,..,400} in 2d
lon[100][100]  longitudinal positions of interpolation points in horizontal axis not necessarily equidistant. eg. {2.34,2.65,2.74... }
lat[100][100]  latitudinal positions of interpolation points in vertical axis not necessarily equidistant.eg. {5.76,5.92,6.26... }
output[100][100]  array containing interpolated values
serial code:
void interpolate(float (*lon)[100] ,float (*lat)[100] , float (*input)[100],float (*output)[100])
{
int i,j,floori,floorj;
float fractionj,fractioni;
for(j = 0; j < 100; j++)
{
for(i = 0; i < 100; i++)
{
floori = lon[i][j];
fractioni = lon[i][j]  floori;
floorj = lat[i][j];
fractionj = lat[i][j]  floorj;
output[i][j] = (1.0fractioni)*(1.0fractionj)*input[floori][floorj] + fractioni*(1.0fractionj)*input[floori+1][floorj] + (1.0fractioni)*fractionj*input[floori][floorj+1] + fractioni * fractionj *input[floori+1][floorj+1];
}
}
}
I need to divide the work in such a way that for all the interpolation points specified using lon and lat values within block of input[floori][floorj],input[floori+1][floorj],input[floori][floorj+1],input[floori+1][floorj+1] should go to one thread so that input values are read only once from memory to register for each thread. 
Amazon Onsite Interview Result
Hi
I have had an Onsite interview at Amazon on March 17th(which i think went well from myside). Still didn't hear anything back from them. I have put a mail on Monday but didnt hear back from them.
1.Can you please let me know if anyone who went around the same date, heard anything back?
2. What does this delay usually mean? Is it a Red flag:(
3. Do they usually sent rejection mails or do they not?
Please let me know!
Thanks in advance! 
Resume tips
I have around about 3 yrs exprience in the field of developing iOS apps,and have developed 8+ apps. My GPA is bad,and i am not from any premier institute, So breaking all my negative beliefs,i have applied for Google and Amazon,i have tried adding whatever i could in my resume,but i am wondering what would that xfactor be that might help me

Applied for software engineer position
I have applied for multiple companies,such as google and amazon,i don't have a github account and haven't contributed to open source or created any library,i have developed 8 applications for iOS,My academics isn't that great,i was wondering if these companies would still give me a chance,if no i would want to know,how to be seen by these companies? How can i make my mark?

Need Help for preparation
Hello Everyone,
I need your help to prepare data structure and algorithm question. Can anyone suggest any book that easy to understand and would take less time to prepare? I am not much confident in Java. Please advise.
Thanks 
Programming questions in Epic Online Assessment test
I've gone through few of the programming questions asked for epic's online assessment test. Most of them are really tough questions considering we have to implement a program within a constrained time.
My question is, do we really need to implement the program or else is it ok if we write an algorithm/approach on how we solve it.
Few people say they have implemented the program in 1520 minute time, I don't think they really implemented the complete program. 
java question
void printArray(int i)
{
if(i==0) return;
else printArray(i1);
System.out.println("["+(i1+"]"+values[i1]));
}
explain the above code for i=1 
Data Structures
List of program files, how will you decide which file to compile first and which later, what data structure you will use for storing these dependencies.

Given a function which return TRUE 60% of the time, how can I create a function which return True X% of the time (X is the input parameter)?
Given a function which return TRUE 60% of the time, how can I create a function which return True X% of the time (X is the input parameter)?
bool random60() { return Random.rand() < 0.6; } Random.rand() return a number between 0 to 1;
bool randomX(float X) { .... } 
Fast way to store employee objects via zip code lookup.
Ok so you have a hash map of employees keyed off a unique key of employee id. But you also want to be able to answer a question which is give me all employees that have the zip code XXXXX, or whatever. What is a fast way to do this? Keep in mind that when you insert/update/delete employees into this hashmap you must also manage any other data structure you have so that the zipcode index is balanced and accurate.
I had proposed to use another hashmap, where the key is the zip and the value is a linkedlist of pointers to the employees in the employee hashmap, but this becomes O(n) for insert/delete and lookup because you have to walk the entire list of elements in the linked list in the zipcode hashmap. Can we do better, any ideas on making this a faster index, lookup and make sure its balanced? Thanks 
Given 5 horses or runners and 10 sensors return top runners
Basically you have 5 horses running. There are 10 sensors spread out over the race. You want the ability to ask what are the 5 fastest horses in order and do so in the fastest way. How would you construct the data structures in order to return the top fastest running horses? Should minimize overhead and be as fast as possible to return the top in order. Any ideas? Thanks.

Given an integer of a certain bit length, does it have an even or odd number of parity bits?
The code is
public static Integer evenParity(Integer number){
return (number == 0) ? 0 : ((number&1) + evenParity(number>>1))%2;
}
I am a newbe, I have a basic question here. We need to count the number of ones and if they are odd, then its odd or even parity bit. Now, when we look at the code, the code keeps right shifting the number until it reaches '0'. So, we are counting bits from different number than the one passed.My, understanding was we should count the one bits of a given number without chaining the number. Even though this code is working correctly I'm not able to understand how this is working.
Thanks 
Best Interview Preparation books now on Rent
Best Interview Preparation books now on Rent on rentsher.com.
Instead of buying, you need them for 1 week or so can rent them. Cracking the PM Interview and ALgorithm for Interviews 
Scalability and memory limits chapter example problem
Hi Everyone,
I'm having some trouble understanding what is on page 113  if the list of words that is being searched among the documents keeps changing, what is the point of the preprocessing that has been explained. Before I looked at their method, I came up with my own "sunny day" solution where we assume there are just a few documents and everything is on one computer. My mappings were from document to list of words, for example, if our list of words is {red, blue, green, yellow}; at the end of my solution the mapping would look something like
doc1  red, blue
doc2  red, green
doc3  green, blue, yellow
and the result would be all of the docs in the mapping  doc1, doc2, doc3.
Those docs that did not contain any of the words in the list, do not occur in the mapping at all.
I guess a valid question for the interviewer is "what is the input to findWords?" OR "is the list of words constantly changing?" To me the obvious answer is yes it is changing. But I am just posting this incase I misunderstood the problem.
Can someone help me understand, what is the use in preprocessing the way it is explained on page 113, when the list of words is constantly changing?
Thanks so much!