Software Interview Questions

551,241 software interview questions shared by candidates

I spent much time for answering a question. Q : In a grid, if points, which refer locations of people, are given, which point in the grid will be the best point to meet together that the sum of distances from each position to the point is shortest. Distance between two points p1 and p2 is |p1_x-p2_x| + |p1_y-p2_y|.
avatar

Software Engineer

Interviewed at Google

4.4
Oct 24, 2012

I spent much time for answering a question. Q : In a grid, if points, which refer locations of people, are given, which point in the grid will be the best point to meet together that the sum of distances from each position to the point is shortest. Distance between two points p1 and p2 is |p1_x-p2_x| + |p1_y-p2_y|.

A array : 1 3 0 2 4 9 input: dest-node: A0 output: all the source nodes: (A1, A3, A4) Each element in this array means the steps it can take. Each element can go left or right. So A[1] and A[4] can reach A[0]. A[1] can reach A[4], A[4] can reach A[0], so A[1] can reach A[0]. Output the index of element which can reach A[0].
avatar

Software Engineer

Interviewed at Google

4.4
Nov 6, 2014

A array : 1 3 0 2 4 9 input: dest-node: A0 output: all the source nodes: (A1, A3, A4) Each element in this array means the steps it can take. Each element can go left or right. So A[1] and A[4] can reach A[0]. A[1] can reach A[4], A[4] can reach A[0], so A[1] can reach A[0]. Output the index of element which can reach A[0].

How to locate the point with the minimal distance to all the given points. Which should be done by a connected graph as all the points on the grid can only move up and down. I tried to answer the question but the interviewer kept asking me is this the global minimum. I don't know!!!
avatar

Software Engineering Internship

Interviewed at Google

4.4
Nov 19, 2014

How to locate the point with the minimal distance to all the given points. Which should be done by a connected graph as all the points on the grid can only move up and down. I tried to answer the question but the interviewer kept asking me is this the global minimum. I don't know!!!

Viewing 2371 - 2380 interview questions

Glassdoor has 551,241 interview questions and reports from Software interviews. Prepare for your interview. Get hired. Love your job.