Infosys Interview Question for Software Engineer / Developers






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

1) break array in decreasing order sets
2) find minimum in each set.

{5,4,2} {7,9,6}

- ragu-ram July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

start ad the end of the array and set current = a[n-1]
iterate backwards
while a[i] > current : decrement
if(a[i]< current : current = a[i]

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i don't think your logic works for 5,4,2,7,9,6,10

- ragu-gupta July 27, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I dont get it.. Why is the solution wrong for the ur test case ?

- Anonymous September 26, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

start ad the end of the array and set current = a[n-1]
iterate backwards
while a[i] > current : decrement
if(a[i]< current : current = a[i]

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

start ad the end of the array and set current = a[n-1]
iterate backwards
while a[i] > current : decrement
if(a[i]< current : current = a[i]

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

bubble sort or selection sort in reverse direction?

- DashDash July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Dont tell me infosys asks such questions.. it is a dumb company and if you get there, you ll be working with a bunch of technically incompetent people

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

IQ test is also a way to examine the ability of employees.
As you can see, not all people in this thread know the correct solution.

- ftfish July 27, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@ftfish do u have right ans?

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Are you sure only decrement is allowed? Not even a single comparison?

- Anonymous July 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Ma k lode... Bhenchod

- Betichod July 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

n is the number of elemnets.
c=a[n-1];
i=n-2;
while(i!=-1){
if(a[i]>c)
{
a[i]=c;
}
if(a[i]<c)
{
c=a[i];
}
i--;
}

- AIT,pune November 25, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

its working....

- AIT,pune November 25, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Either the question is wrongly asked or formatted because if the only operation can be decrement then no logical operations can be done as well. I guess the intention was without swap operation what would be the ideal way to sort it, which is quite straightforward.

Just retrieve the last element from the list and go on reducing all numbers until it equals to that. If at any moment of time the number is lower than the limit to which it has to reduced, then the new limit is set as the present number. Iterate through the loop solution in O(n).

- NirmalGeo May 05, 2011 | Flag Reply


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