Software Engineer Interview Questions in New Delhi, India | Glassdoor.co.in

# Software Engineer Interview Questions in New Delhi

6,266

Software engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

7 Nov 2013
 Given n numbers (P1,P2,P3,.....Pn). Divide them in m contiguous partitions such that the sum of the maximum is minimum. For e.g. (5,1,4,2,3) and m =2 then (5,1)(4,2,3)7 AnswersWas not able to solve this. But some guys used DP.Need to try all options according to m, Can be referred as spanning tree in depth of M. The leaf of the tree will hold the combination of the indexes that we've decided to divide by and than we can compute the min sum and choose the correct leafAssume they are all integers? Get the sum and divide by m. Then try to get sum that can get the exact same value. If can't increase m by 1, try again, until find.Show more responsesBinary search can be used to solve this.Let consider d[ i ][ j ] is solution of the problem when S = {s1, ..., si } and k = j. So it is easy to see that: d[ 0 ][ j ] = 0 for each j from 1 to k d[ i ][ 1 ] = sum(s1...si) for each i from 1 to n d[ i ][ j ] = minfor t = 1 to i (max ( d[i - t][j - 1], sum(si - t + 1...si)) for i = 1 to n and j = 2 to k Now let's see why this works: When there is no elements in the sequence it is clear that only one interval there can be (an empty one) and sum of its elements is 0. That's why d[ 0 ][ j ] = 0 for all j from 1 to k. When only one interval there can be, it is clear that solution is sum of all elements of the sequence. So d[ i ][ 1 ] = sum(s1...si). Now let's consider there are i elements in the sequence and number of intervals is j, we can assume that last interval is (si - t + 1...si) where t is positive integer not greater than i, so in that case solution is max ( d[i - t][j - 1], sum(si - t + 1...si), but as we want the solution be minimal we should chose t such to minimize it, so we will get minfor t = 1 to i (max ( d[i - t][j - 1], sum(si - t + 1...si)). Example: S = (5,4,1,12), k = 2 d[0][1] = 0, d[0][2] = 0 d[1][1] = 5, d[1][2] = 5 d[2][1] = 9, d[2][2] = 5 d[3][1] = 10, d[3][2] = 5 d[4][1] = 22, d[4][2] = 12 Code: #include #include #include using namespace std; int main () { int n; const int INF = 2 * 1000 * 1000 * 1000; cin >> n; vector s(n + 1); for(int i = 1; i > s[i]; vector first_sum(n + 1, 0); for(int i = 1; i > k; vector > d(n + 1); for(int i = 0; i <= n; ++i) d[i].resize(k + 1); //point 1 for(int j = 0; j <= k; ++j) d[0][j] = 0; //point 2 for(int i = 1; i <= n; ++i) d[i][1] = d[i - 1][1] + s[i]; //sum of integers from s[1] to s[i] //point 3 for(int i = 1; i <= n; ++i) for(int j = 2; j <= k; ++j) { d[i][j] = INF; for(int t = 1; t <= i; ++t) d[i][j] = min(d[i][j], max(d[i - t][j - 1], first_sum[i] - first_sum[i - t])); } cout << d[n][k] << endl; return 0;See Skiena's algorithm book. Dynamic programming chapter has this linear partition problem.Binary search the result and greedy check if it is obtainable.

16 Jun 2012
 Puzzle question: A Floating ship contains 1 stone , If I drop that stone in sea,,What will happen with water level??? Is it increase or decrease n why?? 8 Answersafter long discussion... concluded that it will decrease..nothing will happeneven i feel nothing will happen to the level.plz explain the ans.Show more responsesLevel will decreaseYes It will decrease, as per Arcemedes object with same masses upward buoyant force is higher for object which has larger volume area, so when stone is on boat, it increase boat weight and so upward buoyant force is high for boat, but when It is thrown its upward buoyant force is less with compare to when it is on boat, and upward buoyant force of boat also decreases because stone is thrown, so ultimately upward buoyant force decrease than means decrease in water level, hope it will help :)I think it will decrease as when the stone is on the boat the volume of water it displaces is more than when it is thrown into the sea. as more volume of water is displaced the more water level goes up we can say that water level will be higher when the stone is on the boat.The amount of water displaced is equal to the mass of the object immersed. Since the net mass of objects in water is the same, the same amount of water needs to be displaced. Hence no change in the water level.It solely depends upon the density of stone. If density of stone is higher than boat material then it will increase the water level .. Otherwise decrease

### Software Engineer at Intelligrape Software was asked...

27 Oct 2012
 If your basics are clear you will go through.Have to say process is not much difficult (simpler than other companies process), the programs which you have to write are like : print this output: 122333444455555.. 4 Answersfor(int i=1;i<5;i++) for((int j=0;j<=i;j++) System.out.print(i);for(int i=1;i<5;i++) for((int j=1;j<=i;j++) System.out.print(i);any other questions please post here related to programming in intelligrape?Show more responsesfor (int i = 1; i <6; i++) for (int j = 0; j < i; j++) System.out.print(i);

### Software Engineer at ibibo was asked...

6 Oct 2012
 A stream of numbers of length not more than M will be given. You don't know the exact length of the stream but are sure that it wont exceed M. At the end of the stream, you have to tell the N/2 th element of the stream, considering that N elements came in the stream. what would be best space complexity with which you can solve this problem4 AnswersM/4can you please explain your answerHi. Can you please explain how it can be done with M/4 memory?Show more responsesCan be done in O(1). Hint: Implement it like fast-slow traversal on linked list.

### Associate Software Engineer at Accenture was asked...

20 Nov 2013
 nothing was difficult. they came to hire u3 Answerseasy formalitywhat are the questions asked in technical interview ??they asked some basic c questions like null pointer, can we deletenull pointer,wap to find out the largest of three numbers , and apart from my resume project ant trainings 1 thing from 8051 microprocessor as i did training in it.. i am from electronics background so dy dint ask much askd bout dbmsi refused.... gudluck

### Associate Software Engineer at Accenture was asked...

28 Jan 2013
 None2 AnswersSo it was easy - peasy...Just be confidentno not in pune but you have requirement in bangluru for procurement head

### Associate Software Engineer at Accenture was asked...

16 Sep 2012
 What are logs stored on a UNIX server?2 AnswersThey are stored on /var/log/So, you were asked only 1 question and got selected ?? gr88...

25 Oct 2011
 Given two numbers m and n, write a method to return the first number r that is divisible by both (e.g., the least common multiple).2 AnswersA clever way to do this is by using the formulae : LCM * HCF = m * n LCM = (m*n)/HCF there is a simple way to find( with n > m); HCF(m,n) = HCF (m%n , m )Create a loop that multiplies m by the loop counter mod the mulitple of m by n and if the first modulus that is 0 is the least common multiple.

13 Mar 2013