Directi Interview Question for Software Engineer / Developers






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

Sorting the arrays individually in ascending order and then merging them by appending the second to the first would do.

- Kalpana Jalawadi February 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

sort the final array C in ascending order

- Falak naaz Shaikh May 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

biggest*second biggest + ... + second smallest*smallest is the solution.
Possibility of negative numbers in both the arrays have to be taken care of.
negative*negative = positive.

Goal is that C should be sorted. Thats it. try it with sample inputs, all negative, some negative and positive and all positives. It works.

- Sangeet June 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it says 'stable merge' - sorting the arrays (or even the final) would change the relative ordering of the elements in each array

- RB December 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

Just Use Merge operation of merge sort even wothout sorting individual arrays.

for arrays 3,7,1
6,8,2

it will result in 3,6,7,1,8

- Nitin Garg January 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not sure though but this seems to be fine.

- Ishant May 30, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@nitin output should be 6 integers. 2 is missing

- Nitish May 02, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Above solution wont work. For the given case, output should be 3,6,7,8,1,2 to maximize the sum of products.

- Ajay Narang July 29, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

ur solution is not a stable-merging

- shaan October 16, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

3, 6, 7, 8, 2, 1

- jackass October 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

how the solution 3,6,7,8,1,2 is not stable merge? pls explain

- Nitish May 02, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Here is one logic :
Start from first element of array A[], now to maintain stable merge as well as maximum sum property choose max(next element, Ist element of B[]), now do in this way merging for all next element, it can give you array C[] which is stable merge as well as have max sum of product of adjecant elements.

- L.Ppt July 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

You just need to make sure final array is sorted.

- funvin January 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I am very sure its not that simple :)

- game January 15, 2010 | Flag


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