# Interview questions in Bengaluru

Accenture Interviews in Bengaluru

www.accenture.com / HQ: Kronberg im Taunus

1,140 Interviews in Bengaluru (of 11,559)

Infosys Interviews in Bengaluru

www.infosys.com / HQ: Bengaluru, IN

968 Interviews in Bengaluru (of 7,370)

www.wipro.com / HQ: Bengaluru, IN

719 Interviews in Bengaluru (of 4,162)

## Interview Questions in Bengaluru

### Software Engineer at IBM was asked...

Puzzle: How do you weight an elephant without using a weigh machine? 34 AnswersUse a pool -> calculate the volume of water of the pool and the water level, put the elephant in the pool, take note of the level after the elephant after it is in the pool. By Archimedes principle, the volume of water dislocated is the same as the weight. So the weight of the elephant is the same as the difference in water volume. Not quite. The volume of the water is not the same as the weight of the elephant. You'd have to estimate the density of an elephant and multiply that by the volume of the water to get the mass, then multiply that by the acceleration due to gravity in water system (SI, English Customary, etc.) you're using. Luckily, mammals are mostly water (humans are around 70% water on average), so about 2/3 of the weight of the elephant would be equivalent to the weight of the water displaced. So you would have to estimate how dense the rest of the elephant is (since it'd be minerals and such, I'd say it's more dense than water) and follow the steps described above. Apply a known force to the elephant and measure the acceleration. Use physics to deduce the mass. Show more responses As it is not specified that the International System of Units must be used, define the Elephant unit (E) as the weight of your elephant. Your elephant then weights exactly 1E. Kyle I have to disagree with you. According to Buoyancy principle: Any object, wholly or partially immersed in a fluid, is buoyed up by a force equal to the weight of the fluid displaced by the object. So if you calculate the displaced fluid weight, which is quite easy in water as it is very close or equal to 1kg/L, you can get very close to the real weight of the elephant. Hmm, I think Kyle is right... and so are you when you say "Any object, wholly or partially immersed in a fluid, is buoyed up by a force equal to the weight of the fluid displaced by the object". IMHO elephants don't float... Actually Kyle is right. If we put something in the water, such as an sealed box with a ten pound weight inside (does not float), it will displace a proportionate amount of water. However, if we fill it up with a 50 pound weight, the same amount of water will be displaced, however. Fernando, you are using the Buoyancy principle. The Buoyancy principle is meant for objects that float (hence the word buoyancy-it means pressure to keep afloat). As Wouzz said, elephants don't float. You could just put a boat in water, measure displacement. Then put the elephant in the boat and take the difference. The displacement is going to equal mass as long as it's floating so you're good in a boat. Kyle was right that if you just threw an elephant in a pool, you would have you figure out density and all that. I would say bring a female elephant and let them enjoy life.. Isn't that just an improvised "weighing machine"? it sounds like you all are trying to determine whether an elephant is a witch (Monty Python reference). Instead of dealing with the whole mess of a wet elephant, why not use other pneumatic tools like an inflatable platform, an air pump, and a pressure sensor. See how much air pressure is required to lift the elephant. My experience is this, you don't have to have a perfectly correct answer. The goal of the question is to see if you can think around a problem. Besides elephants, I have heard 747's and aircraft carriers used as the object. A good answer shows that you thought of an alternate way of measurement, so the water displacement and pressure sensor ideas work. PS, if they ask you to weigh a 747, I would answer "Land it on an aircraft carrier and measure the additional water displacement!" I would use a see saw to weight my elephant. Using my weight (212 lbs in work wear), move the elephant until we balance, and then compare my distance to the pivot point to Clancy's distance to the pivot. (I named my elephant Clancy). The hardest part... finding a see saw strong enough to hold Clancy. Show more responses Archimedes Law of the Lever states: Magnitudes are in equilibrium at distances reciprocally proportional to their weights. "Give me a place to stand on, and I will move the Earth." Elephants DO float, even in fresh water. They're blubbery. Simple answer : Use a beam balance . Put elephant on one side and start throwing weights on the other side . When the beam is balanced you got the weight of the elephant equal to the sum of weights on the other ! Just ask him... Just find a person having a bad day and weigh him/her, help that person feel better, then weigh him/her again. The difference is the weight of the elephant you removed off his/her back. Works for monkeys too. one "weight"(s) by putting a weight on it note that the answer above is referenced to the question on THIS page which has been transcribed wrongly from the "home page" question (the "t" has been added) I would ask if it was an Indian elephant or an African elephant. I would solicit bids and then sub-contract the task to a reputable, cost-effective elephant weight service vendor, and let THEM decide the best approach.They can use a weigh machine or use any other method that does not require ME to use a weigh machine. The question (and answer) are no different than any other variation of, "How do you accomplish a task when you don't have the needed resources?" by using first clas lever. keep an elephant at known distance from the fulcrum; make the effort distance long enough that your weight balances the weight of an elephant; by using the formula load*load distance = effor*effortdistance( principle of lever) you already know load distance, effort distance and effort now you can calculate load, which is nothing but elephan'ts weight Show more responses By using the momentum conservation law, First I find a heavy enough object mith exact mass of m1 and then throw it with speed V1 to the elephant which is standing on a friction-less surface like ice or on plate with wheels under it to reduce the friction. after they meet, the elephant will move. and the object will change its direction and speed. Then I calculate the speed and direction of elephant and reflecting object, and finally I solve the vector equation below: m.v1=m.v2+M.V v1=vector of initial speed of object v2=vector of final speed of object M=elephant mass V=vector of elephant speed elevate the elephant to height "h". it will have potential energy of "U=mgh". hurl the elephant into a well which is vacumed well to avoid friction. at the end of the well, there is a pool of water with exact mass of " m' " and temprature of T1. after elephant reaches the pool he will give all of his energy to water causing water to become warmer Q=U. so mgh=m'c(T2-T1) with knowing g,h,m',c,T1 and T2 m can be calculated easily. place elephant on an iron plate and move it horizontally with steady speed v. and pass them through a constant magnetic field of B. change B untill the elephant start to move upward. read B and V. F=V x B is the force of magnetic field ( x denotes vector multiplication) which is now equal to weght force W=mg. knowing g the gravity constant, solve m. use SEE SAW put elephant on one side and on other side some men when it get balanced weighs the men Possible answers: 1. Zero. Take the elephant to space. The weight = 0. 2. I can guess it to around 150 kg ( there is fat person who lives next door and we call him an elephant his weight is 150 kg) I got asked this question. But the water displacement has gotten old. They prompted me for another answer. I said you measure the elephant and find out its volume in cubic meters. Then weigh its leg and measure it. Lets say the leg weighs 20 kgs and has a volume of 20 cubic metres. Then, each cubic metre weighs 1 kg. So if the total volume of elephant is 350 cubic meters, it will weigh 300 cubic metres. Take heavy weight gym dumbells keep start hanging with the one end of the rope an the other end to elephant and the rope goes over the pully,keep adding weight till elephant gets lifted esimate the answer to certain range and put it on a boat and if the boat shrinks it is more than the estimate weight else less else use F=MA forumula apply certain force and the calculate acceleration and then mass OK guys i take a boat which can carry more than a load of an elephant i keep the elephant in that boat [ there fore designed load = load of elephant+ X load] i will add some more load by boarding some swimmers one by one into boat if it starts sinking it means it reached designed load [designed load By allowing him to sit on us Show more responses Fernando,Your answer is really very wierd. First of all: rise in level of water will be equal to elephant's volume not weight. There is a vast difference in volume and weight. Second: if you think that you will estimate it's density to calculate it's weight then it will be a wierd thing because you will never be able to guess it right. Third: rise in level of water of pool will indicate the volume of submerged part of elephant and not whole elephant. If you think that you will submerge whole elephant then obviously you are killing it .So your answer is scientifically and economically wrong. I might suggest that you should take a help of a strong boat to determine elephant weight. take the boat in water and elephant on the boat.the boat will obviously sink a little.mark the level. now get elephant off the boat and put some weights on the boat till it reaches same level. now measure the weights and you will get the weight of elephant THANK YOU |

### ETL Tester at Capgemini was asked...

Interview was pretty simple,good amount of basic questions were asked in the written test. 16 AnswersInterview process was good,its a walkin almost 2000 people attended the interview.....selection procedure and other aspects are well mannaged. did u get the offer letter if not then will they release offer letter did u get the offer letter if not then will they release offer letter Show more responses divya: No dear....awaiting... No dear...no offer as of now :( How about you? I have got two mails from Capgemini....I have pinged them from my office communicator...they told me they are just taking data from the candidates and posting that to their HR named Meenakshi... on which date did u attend the interview 9 th Sep....Bangalore Ecospace....How abt ur interview Divya? i attended sep 15 noida walkin , i have cleared hr round after that they are telling me to wait for the offer letter and on which date date did u attend the walkin my interview was on qtp automation testing it was good exactly what did the mail from meenakshi says exactly what did the mail from meenakshi says can u give me u r cell no plz i wanna talk to u ping me on siva.vakacharla at gmail.com...couldn't see ur responces Show more responses plz give me u r cell no 0727384596 meeenakshi never mailed me ...i have pinged people who mailed me((Piuyush)) .....on my office communicator..they told me meenakshi will get back to you... |

### Applications Engineer at Oracle was asked...

You have 2 light bulbs. You are in multistory building such that if you drop a bulb from a floor of a certain height or higher the bulb will break: for ex: if the bulb will break at a minimum height of 10th floor, then the bulb will break if dropped only if dropped from a floor higher than tenth floor. it will not break if dropped from ninth floor or less. using the two bulbs how will you figure out at which floor will the bulb break? 13 AnswersKeep going from floor to floor starting from 1 to 2 to 3 and so on.....the first bulb will break at the threshold. So you basically don't even need the second bulb to decide which is the critical floor. I forgot to mention that you have to try to figure out the floor in the least amount of tries. so incase the minimum floor is 100, you shouldn't try all the floors. The solution posted above works, but is the least efficient. With 2 bulbs we can skip 3 floors at a time. 1) Drop bulb #1 at floor x 2) If it breaks then try floor x-1 else try floor x+3 Start with floor 1. Show more responses Those examples listed are good solutions, but if you wanted to make a bold attempt at wowing them, then here's one answer. This one allows you to save both bulbs and conserve them, which is why I think this answer has a potential wow'ing factor! It's also the answer I would give as a supplemental...it's pretty outlandish for it to stand as your only answer. Using the two bulbs you'll know the make and model. Retrieve the information from the manufacturer that gives data on the physical characteristics, i.e. stress, that the light bulb's glass can take. Then make a calculation that tells you at which height will that stress be reached if you were to drop a bulb from that height. You can also figure out the influence from the material the floor is made of. After that, you go home into your apartment and put those light bulbs back where you found them haha The issue with a research-based answer is that parameters of the posed problem is not based in reality, i.e. dropping a light bulb from any floor would almost guarantee it breaking in real life. So the interviewer is really looking for problem solving skills for an hypothetical situation rather your attention to detail in a real world situation. use they way u use binary search. STEP 1:divide number of floors(n) by 2 = n/2 , drop it there STEP 2: if it breaks, repeat step 1 taking n= n/4 STEP 3: if it doesn not break, drop it next at n=3n/4 refer BINARY SEARCH @Keshav: What if first bulb breaks at n/2, then according to binary search the next bulb will be dropped at n/4 as u mentioned. What if the second bulb breaks at this point. You dont have any bulbs left to find to out if the threshold is lesser than that???? You start with the n/2 floor. After that you go one by one from either 1 or n/2 +1 until it breaks. If it does not break at n/2 you can go to 3n/4 and try. depending on floor this will either save or possibly add one additional drop. This always gives you Floor + 2 drops (or Floor - n/2 + 2 drops if it is a high floor) 1. Start with the 13th floor. If it breaks, start checking sequentially from floor no. 1 (1, then 2, then 3, and so on) 2. If it doesn't, go to the 13+12th floor = 25th floor. Then to the 25+11th floor = 36. Then 46, 55, and so on. If the egg breaks at, let's say the 55th floor, starting checking for the 46th, 47th, 48th (...) floor till the 54th one. The advantage of using this procedure is you're able to find out the exact floor in a maximum of 13 steps. I guess the bulb would break from 1st floor itself :p Assuming no of floors = A, tester can escape x floor at a time e.g. if x = 10, test at 10, 20,30... If 1bulb breaks at 20, test from 11 to 19. So solution is minimum of (A/x + x-1) using derivatives x=√A is for minimum i.e. min value is A/√A +√A -1 =2√A-1. Example for 100 floors minimum is 19 it depends the speed and the force it is doped Start from floor 1, drop the bulb. If it breaks, then it tells you that at any floor the bulb will break. But, if it doesn't use the same bulb to test its survival on n+1 floor. By continuing this you will reach a floor where the bulb breaks. Hence, you identified the floors where the bulb breaks (BFloor) and the floor where it doesn't (BFloor-1), also you have saved a bulb for use. |

### Software Engineer at Google was asked...

Come out with an algorithm for getting the column number provided the column name in a excel sheet and vice versa. Excel has a naming convention of A,B..Z,AA,AB,AC..ZZ,AAA... This had to be converted to the column numbers. A will be 1 and AA will 27.. Also the algorithm to find the name provided column number. 13 AnswersIts conversion from decimal to base 26 with some exception like there is nothing maps to zero. There might be a better way to do it. void printColumn(uint32_t col) { col --; int div = 26; int add = 26; while( col / div ) { div *= 26; } div /= 26; while( div != 1) { printf("%c", (col / div) + 'a' - 1); col = col % div; div /= 26; } printf("%c\n", col + 'a'); } Opps above does not work after ZZ. The correct one is void printColumn(uint32_t col) { int a = 26; int denominator = 1; while(a 0; i /= 26) low += i; // if value is lower than lower bound, decrease quotient by one if( denominator != 1 && col < (quotient * denominator + low) ) { quotient --; } printf("%c", quotient - 1 + 'A'); col = col - denominator * quotient; denominator /= 26; } } Show more responses Let the size of the string asked is 3 e.g GHD . The formula to this : [ 26+26^2+...+ 26^(size-1) + (LetterIndex-1)*{26^(size-1)+....+(LetterIndex-1)*26}+Index ] In the code the above formula will use recursion to find the column number. The answer can be as simple as finding the first combination of number * i such that it is less then xcelcolvalue; ie repeat this till xcelColValue >= 26 ( 0 = 26){ int i = 1, num = 1; while((num * (i + 1)) 26){ i = 1; num++;} else i++; xcelNum -= num*i; sb.append((char) i); } if (xcelNum > 0) sb.append((char) xcelNum); return sb.toString(); } Also the above code is rough idea and not tested but gives enough idea on simplifying the solution. The code does not use lot of / and % calcuations but could elegantly find the solution. Note the Gaurd if(i > 26){ i = 1; num++;} else i++; which is important in finding the combination of num and i which multiples at least to xcelNum. I think the above is incorrect and it should be : public static String xcelString(int xcelNum) { StringBuffer sb = new StringBuffer(); while(xcelNum >= 26){ int i = 1; for(;(26 * (i + 1)) 0) sb.append((char) xcelNum); return sb.toString(); } Edge conditions aside, the program would be /* inputString - the column name. For e.g. "BZC" */ char [] columnName = inputString.toUpperCase().toCharArray(); int columnNumber = 0; for(int i = 0; i < columnName.length - 1; i++){ columnNumber = columnNumber + (int) Math.pow(26, (columnName.length - 1 - i)) * (columnName[i] - 64) ; } columnNumber = columnNumber + (columnName[columnName.length - 1] - 64); System.out.println("Column number is " + columnNumber); Edge conditions aside, the program would be /* inputString - the column name. For e.g. "BZC" */ char [] columnName = inputString.toUpperCase().toCharArray(); int columnNumber = 0; for(int i = 0; i < columnName.length - 1; i++){ columnNumber = columnNumber + (int) Math.pow(26, (columnName.length - 1 - i)) * (columnName[i] - 64) ; } columnNumber = columnNumber + (columnName[columnName.length - 1] - 64); System.out.println("Column number is " + columnNumber); int columnNumber(String col) { result = 0; for(i = 0;i< strlen(col) ; i++) { result *= 26; result + = col[i] - 'A' +1; } } int columnNumber(String col) { result = 0; for(i = 0;i< strlen(col) ; i++) { result *= 26; result + = col[i] - 'A' +1; } } public static String numToExcel(int n) { if(n 0) { int remainder = n%26; char newChar = (char) ('Z' - (26 -remainder)%26); result = newChar + result; n = (n-1)/26; } return result; } |

### Project Manager at IBM was asked...

Difference between Risk and Issues in Project Management 8 AnswersRisk is something you anticipate in Project whereas Issue is something that is already happened in Project had the same question during IBM internal interview ? Issue- potential to impact – have a plan to mitigate. (Is a "Known") ? Risk – We can devise plans to mitigate but no expected ETA.(several unknowns)- Also Risk can become an opportunity Show more responses Risk is something that can happen in..coz of some problems and the issue is something created due to these risk.. Risk is the challenging attitude of a duty in human mind. Issue is the after effect and man made attitude against duty. Risk events are identified in advance, it may or may not happen. Once a Risk gets realized, it has a potential to become an issue. Risk is something that can happen in future while issue is a current event, something that has already happened. Risk may or may not occur but issue is a problem that has already occurred. Issues tend to need a more reactive responses while Risks require proactive planning. Risk can be predictable and will be preventable. But if there is an issue, its cause of bad planning and execution. Risks can be anticipated in advance by careful analysis of dependency factors or limitations. where as issues are already known problems. |

### Software Engineer at Google was asked...

How many rotations does earth make on its axis while going around the sun for one year. 10 AnswersDepends on the Leap Year or non Leap Year 365 for Non Leap Year 366 for Leap Year The question is flawed. It should either ask how many days earth takes in one revolution around sun, or how many days are in a year. The leap year is something imaginary humans have concocted to make the calendars look good. You can't say once is 4 years earth takes an extra day to go around the sun. It's to get you thinking about casting... the calender is a double casted to an int! Show more responses 365.25 / yr I wouldn't say 365/ 366 leap year. Jain has a point.^ It's either 364.25 or 366.25 depending on whether the earth spins in the same direction as it goes around the sun or not (I don't remember which it is and can't deduce it from the information that's available to me without looking it up). Imagine if the Earth did not spin at all on its axis so it would seem as if a year was equivalent to one day. It will take the Earth rotating either 264.24 or 366.25 times depending on the direction to seem like the 365.25 days that it does take. Every year it takes 365.25 rotations but while making calendar we ignore that 0.25 for 3 years and add an extra day in 4th year. <b>365.25 is WRONG!!!</b> Actually <b>Anonymous</b> is right! Just think about this (lay it out on your desk): <ul> <li>How many days would there be if the earth would not revolve around its axis?</li> <li>How many days would there be if it turned once around it's axis?</li> <li>Now do again one, change the direction the earth revolves it's axis, but keep going the same direction around the sun ...</li> </ul> The concrete right answer is 366.25 Here you find details on the exact number (with other proof): :) All answers here are false and crap. To say a leap day is added to look good is a lie. To say 365.25 rotations is also a lie because it is 365.25 days not rotations. It takes 366.25 rotations making the 365.25 days, so that in 4 years 1461 days are made by 1465 rotations. If the Earth rotated the opposite direction then the 366.25 rotations would make 367.25 days and the 1465 rotations would make 1469 days. Simple math, but the idiots rule the world, while retarded ones worse than the idiots try to play smarter and CAN'T. Same as with Venus it takes 1.62509035863 orbits to make 0.62509035863 synod. Mathematical geometry that all cycles differ by exactly ONE. (Like the 366.2422 to produce 365.2422, and the 366.2425 to produce the 365.2425, and the 366.25 to produce the 365.25 and this is why Venus takes 1.62509035863 of 224.606267349 days to make 0.62509035863 of 583.924347116 so that if the math is not an exact balance then you have the wrong figures. 1+fractional A times one orbit = fractional A times one synod. And so 13 orbits around the sun appear from Earth as 5 times around the sun. Or more precisely when the math is checked to be exactly equal by this LAW that I discover, 13 orbits will appear as 5.00044481781 synods as seen from Earth, and 5 synods (superior conjunctions) will be 12.9988435764 orbits. This question makes no sense. It's other way around, only when earth complete one round, we call it a year. To make human calculations easy, we introduced leap yrs. |

### Business Analyst at Mu Sigma was asked...

i have a gun in each hand, one with 3 bullets and other with 2. i fire them together at you, what is the probability that you die? 17 Answers2/6*3/6 + 4/6*3/6 + 2/6*3/6 = 2/3 is correct. 1 - 4/6*3/6 = 2/3 is a better answer. the corrent answer is 5/6 . since both the guns are fired at the same time and both the guns do now hve any connection so probability of 1st gun firing a round is 3/6. and probability of 2nd gun firing = 2/6. now we will add then wince they are mutually exclusive. 2/6 + 3/6 = 5/6 From a Business Analyst perspective, I will not assume that the formula for calculating probability is the same as what I understand it. I will confirm from the SME and that is the Business Rule. I will determine the factors that can affect the firing decision by asking some questions. What are the different factors that makes the user pick up one gun or 2 guns? Is the user aware which gun has how many bullets? Is that a factor in decision-making? Does the user like to bluff sometimes? How frequently? etc. Show more responses 1 - P(gun1 failed) * P(gun2 failed) = 1 - (3/6)*(4/6) = 2/3 I guess it is a six revolver. 1-3/6*4/6=2/3 * Why to assume the revoler to have 6 slots? A die is thrown, possible outcomes are 1, 2, 3, 4, 5 and 6. Likewise, a bullet is shot, possible outcomes are hit or no-hit. Now the possibility to die is probability that atleast one bullet hits the target = 3/4 * If a six bullet revolver is assumed, then the total possible outcomes is 12. The probability to die is the probability that atleast one bullet hits the target = 3/12 = 1/4 Ho there is a glitch! * If a six bullet revolver is assumed, then the total possible outcomes is 36. Now the possibility to die is probability that atleast one bullet hits the target = 3/36 = 1/12 The prob should be 5/12. Lets consider a case where both the guns have 5 bullets each, simply adding i.e, 5/6 + 5/6 would give a prob greater than 1. To kill, any one of the bullets in either of the guns need to be in the slot that gives 5/12. probability of 1st gun firing a round is P(a)=3/6. and probability of 2nd gun firing P(b)= 2/6. probability of 1st gun FAILURE P(a')=3/6 probability of 2 nd gun FAILURE P(b')=4/6 3 conditions are possible p(a)*P(b')+P(a')*P(b)+P(a)*P(b)=2/3 probability of 1st gun firing a round is P(a)=3/6. and probability of 2nd gun firing P(b)= 2/6. probability of 1st gun FAILURE P(a')=3/6 probability of 2 nd gun FAILURE P(b')=4/6 3 conditions are possible p(a)*P(b')+P(a')*P(b)+P(a)*P(b)=2/3 Answer - 5/6 Solution - Either bullet is fired from Gun A or Gun B P(A) = 5C2/6C3 P(B) = 5C1/6C2 P(A OR B ) = P(A) +P(B)= 5/6 You Shoot and I die , simple ,now do I need wait to calculate your probability but the question doesn't specify how many bullet shots will lead to death of person that data too is important Show more responses 83% of getting killed the chance of getting killed is 41% and the chance of survival is 59%.. the chance of getting killed is 41% and the chance of survival is 59%.. If its a probability question to a school kid the answer is pretty direct, but to professionals, shouldn't they be asking for other inputs like what other variables are at play? Also are we looking at a target hit or kill? For kill the probability reduces since of all the exposed area, the bullets have to hit the critical to life parts /arteries/veins etc. Other angles at play are wind velocity, distance, even type of gun, for example a double barrel gun will have two bullet slot and if the second gun being used is a double barrel and we are shooting the target at point blank, there is no question of probability ..target will be hit...,but if the hand angle is low, shooting at the feet may not result in a kill.. |

### Software Engineer at Google was asked...

Can't disclose the exact question because of NDA, but here's some food for thought: 3 can be written as 1+1+1, 1+2, 2+1 4 can be written as 1+1+1+1, 1+1+2, 2+2, 1+2+1, 2+1+1, 3+1, 1+3 Given an integer, how many possible expressions exist? (1+2 and 2+1 are different) 8 AnswersThere are total 2 ^(n-1)-1 expressions exist for any integer to be written on the basis of integers < the given Integer. Like for n=3, total 2^(3-1)-1= 3 expressions. For 4, 7 expressions exist and so on. No f(1) = 0 f(2) = 1 f(n) = Σf(i) + (n-1), where i = 1 to n-1, n>2 Show more responses Ader Lee: Shouldn't it be: f(n) = Σf(i) + (n-1), , where i = 1 to n-2, n>2 (i ranges from 1 to n-2, not n-1) f(1) = 0 and f(i) = i - 1 + sum_{i = 0}^{i - 1} f(i) Writing it down helps to find the sum: f(1) = 0(0) f(2) = 1 + 0(1) f(3) = 2 + 1 + 0(3) f(4) = 3 + 3 + 1 + 0(7) f(5) = 4 + 7 + 3 + 1 + 0(15) The first term(i - 1) equals the number of second terms and the second terms are the sum of 2 powers - 1 from 0 to (i - 2) so f(i) = 2^{i - 1} - 1 Also there is a neat normal form to generate all variations. For the sake of simplicity I show it for i = 4: Start from 1 + 1 + 1 + 1 and for j in 1 to i - 1 add together j and (j + 1) and write down the numbers and mark the added number in the next iteration. | | | 2 + 1 + 1 1 + 2 + 1 1 + 1 + 2 From the marked numbers to (last - 1) run j and do the same as before. The first generates 2 more, the second 1 more and the last one none. gen by first | | 3 + 1 2 + 2 gen by second: | 1 + 3 We could also generate the one element sum(4) from the first one but it's not needed in the problem. Also this representation looks nicer in a tree form but I can only type text here. The marks moved to the begining of the rows since the forum probably has some nice mangling algorithm. I hope you can figure out how the normalisation works. Might post some python code which does this later. a coin change problem with little modification will do . |

group discussion topics will be quite unexpected and group discussion is not a round one bt like a class room type discussion 8 Answerscan u please help me with the written test pattern?? its urgent can u please tell me the pattern of written test ? i mean i was just aptitude or technical questions were also there? these was no written test for me as i was shortlisted based on amcat scores Show more responses how was the gd and wat all were the questions asked and wat was its level can u pls tell me where can we get interview qsns for ntt data for freshers what were the rounds? And what were the questions asked in interview ?? can u please tell me the level of interview questions in technical round HEY GUYS... NTTDATA offered us a campus drive and it had basically 4 rounds 1. AMCAT based writing test (aptitude, logical reasoning, computer programming, English comprehension) 2. group disscussion 3. technical round 4. hr round Gd topics please¿¿¿ |

Find all anagrams in a file. Improve the running time to O(n). 7 Answersfor each work in the file, sort the letters in the work and add the result into a stack, if there is a collision, the original word is part of set whose words in that set is an anagram. Since adding to a stack only take O(1) and you must visit each word once, the complexity is O(n). The way I approach anagrams is that I assign a prime number to each letter and then multiply the letters. In theory, ABC gives you say 3 * 5 * 7 = 105 Any anagram will have letters that when multiplied give you 105. In the solution above, it's far more than O(n) because of the sort step which depending on how you're trying to sort could wind up nlogn or n2 or something like that. I should note that this is generally good to about 9 characters, at which point overflowing becomes an issue and you'll probably want to go to some construct such as BigInteger in Java or go with what Anonymous presented. Show more responses @SeanB: Instead of multiplying number just add them. Adding won't cause a big value for stack overflow or something.(e.g A=1, a=1: b=2, B=2...so on.) Rule of Association in maths. That would do. However even for multiplying or adding we have to split the string which will involve some complexity, therefore that might not make the whole operation o(n). @SeanB, thats good idea, adding to that: we can map a prime number for each alphabet. if any string has same multiplied product then both should be anagram. For example: Map the first 26 prime numbers to "abcd....xyz" "1, 3, 5, 7, 9, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97" now consider the anagram: "cinema" and "iceman" the product of the two numbers will be same. Since we use prime numbers, the factors should be same. so its proved that both are anagrams. To check overflow: 97 is for the char "z", and usual word size is 10. So, Math.pow(9, 10) is 73742412689492830000 and which still finite. @Jimmy: There is a small flaw in your assumption. Let's say we take the prime number sequence as 1, 2, 3, 5, 7,,, assigned to A, B, C, D, E etc Your assumption would give out the same answer for "BC" and "D". But these two are two not anagrams. So i guess i better approach would be to multiply the numbers. 1 is not prime man |