## Andy2000

BAN USER- 1of 1 vote

Answersdesign Malloc Function which user can call and get the allocation. For example, there is a Byte array of byte[1000] so if use call getAllocation(3) then we will assign 3 bytes to user. and again if another user call getAllocation(100) then we will assign again,

- Andy2000 in United States for STB| Report Duplicate | Flag | PURGE

Microsoft Software Engineer in Test Algorithm - 0of 0 votes

AnswersWrite an algorithm to insert a new value into a circular sorted linked list.

- Andy2000 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm - 0of 0 votes

AnswersInterview Question – how to improve a parallel cache, this is the most difficult question i got. I had no idea what the interviewer meant and he clearly had some 'right' answer in his mind, but no clue.

- Andy2000 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm - 0of 0 votes

AnswersHow would you store 1 million phone numbers?

- Andy2000 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm - 0of 2 votes

AnswersOn a 2-D grid, the positions (x,y) of 3 persons are given. Find the meeting point such that sum of distances of each person from meeting point is minimized.

- Andy2000 in United States

Now generalize this to N persons and solve.| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm - 0of 0 votes

AnswersDesign Chess Game. asked me this in testing interview.

- Andy2000 in United States| Report Duplicate | Flag | PURGE

Microsoft Software Engineer in Test Algorithm - 1of 1 vote

AnswersYou have a circular Linked List:

- Andy2000 in United States

a->b->c->d->e->c

Find where the cycle is starting| Report Duplicate | Flag | PURGE

Microsoft Software Engineer in Test Linked Lists - 1of 1 vote

AnswersYou have 2 sorted Arrays. A and B. A is shorter than B. B has few elements in sorted order and has space for all elements of A. Now Merge these both array so that All elements are sorted. You cant use extra Array. Use Only Array B.

- Andy2000 in United States| Report Duplicate | Flag | PURGE

Microsoft Software Engineer in Test Arrays

Frank,

I am still not sure how slow and Fast Pointer will meet to find duplicate. This seems to be true in case of detecting cycle in Linked List but in case of array where even numbers are not sorted, this wont be able to find the duplicate until and unless you want to read all elements of a given array and draw a Linked List? Do you intend to draw a Linked List first?

@stevejobs, the Map solution is worse that what ever is described. Building TRIE will come at huge cost, So I was thinking:

if we know start/end and Blocked cell (I still dont know how we know that but thats the question for interviewer) so we can iterate the Blanked cell in 8 directions and also creating combinations of different length for each direction and Keep searching for either of these combinations in dictionary. by putting wildchar * in blanked cell. I am thinking aloud here but could be worth a try.

what do you guys suggest?

I think this is simple designing question. In which we will have 2 function:

1) GetTime, Which will give current time

2) Set time, In this function we will take 2 counters, 1 is for minute, 2nd if for hours. Then based on changing variable we can increment minutes and hours. Also we will take 2 more variable, Max Minutes and Max Hours which will trigger resetting of Minutes and Hours function.

I would think that if we could draw the countries in number line and then limit the random number generation with max distance on the number lines. Like generate random number between a given range and in that we can give a range of farthest distance of line. And in every call change the range of Random number.

- Andy2000 September 06, 2012I dont believe that drawing a number line will help here. Number line solution would be somewhat similar to sorting the list.

I think the solution will be in terms of probability. Also, for finding the highest populated country, we need to know the limits of list.

Not sure how it can be done by randomly selecting. If we know the Min and Max then we can pick some values randomly and decide.

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Lets say we are 3 stacks

- Andy2000 December 23, 20121 3 2 Now 3 will grow in right side and 2 will grow in left side. For example, there are 12 spaces in entire array, hence all 3 stacks get 4 each. Now we have filled 8 elements for the stack ID 3 and 2 and for stack 1 we just free 2 elements. Now we want to fill more element in stack 2 or 3 then your program will give Error.

In my opinion, in this case, we need to shift the starting index of stack 3 to left so that we can make spaces for Stack 3 or 2.

What do u think?