# Interview questions in Hyderabad

Amazon Interviews in Hyderabad

www.amazon.jobs / HQ: Seattle, WA

516 Interviews in Hyderabad (of 16,188)

Deloitte Interviews in Hyderabad

www.deloitte.com / HQ: New York, NY

443 Interviews in Hyderabad (of 8,796)

Infosys Interviews in Hyderabad

www.infosys.com / HQ: Bengaluru, IN

395 Interviews in Hyderabad (of 5,862)

## Interview Questions in Hyderabad

### Product Quality Analyst at Google was asked...

Do you have any questions? 45 AnswersI had researched a lot and had a fair amount of knowledge anyway so I refrained from asking questions in a couple of interviews. Later on, I realized it's actually a great sign if one can ask relevant questions based on the just conducted interview (and not researched, well-rehearsed questions). after first round of phone interview with some one from operation team, how many days does it take to get called for second round of interview? I got a call from the HR within a couple of hours confirming that I'm through to the next round. I think the official mail came in about a day or two. Show more responses oh ok i'm yet to get that call from HR though the interview went good. If you don't hear from them in 2-3 days, just drop a mail to the recruiter. All the best :) yep thanks. I had interview today and i was told that the HR will be in touch. Lets see what follows. Thanks again for your time. :) could you please help me with what types of questions should I expect in second round of onsite interview of same? Atleast those questions that were asked to you. Thanks. I'll give you the same advice I got. Be ready for on-the-spot analysis since they're going to give you case based questions, i.e. given a particular situation what would you do. These are mostly role related but I did get a few advertising or marketing related questions as well. Google about Google as much as you can :) I really need help regarding the process of phone interview,as I have phone interview within 3days.I mean what all the skills they may conclude by the end of phone interview? Hope someone replies. Thank you. read the topics mentioned in the mail you have received from Google reg interview. Be ready for any google's product analysis. Present your views proactively. It will be so friendly interview that you wouldn't feel that you are actually going through it. They check thought processing speed and different thinking. Relax and give your best. How many days will it take to complete all rounds of interview if we able to clear call.I mean will it take couple of days or months time? 2-3 weeks for the interviews, and another 2-4 weeks before the final offer. Yes, that waiting period, where you know your local office wants you but you're still not sure whether US office will give the go ahead, is agonizing. But trust me, for Google, the wait's worth it! XD i had first onsite interview on 23rd and haven't heard anything from Google yet ( 3 days) what that mean? Does Google inform the result of interview process or it just stop communicating in case you couldn't make it? Any word of advice would be appreciated, Show more responses Thank you very much for replying back for my doubts.so may i know the package for the product qulaity analyst-hyderabad role? I've had two interviews so far, an introductory one with the recruiter and a more detailed one with someone from the team. Been 3 days but havent heard anything yet. How long will it generally take for them to revert? And I presume they will let you know if you didnt cut it? I have been scheduled the last round with the director next week. Any hints? Is there a higher probability that we may be selected if we progress till this round? Well, common sense says so. They shouldn't waste the director's time unless the candidate is worth considering. I wouldn't know more than that since I'm yet to join ... what I can tell you is though it's gonna be very short interview 15-20 mins, and will cover more of basics ... it's more like he wants to get to know the person they're seriously considering hiring. All the best! Hello, I received a mail stating that " Someone at Google thinks you'd be a great fit here. We're looking at your skills and experience to see whether we have the right opportunity for you. In the meantime, to learn more about who we are and what we do, here are a couple of resources to give you a better sense of life as a Googler. Check out our Official Blog to stay up-to-date on our products and company news Peek into the day-to-day lives of Googlers on our Life@Google YouTube channel Browse our @Google Talks YouTube channel, full of visits from artists, authors and politicians Read up on how to best prepare for an interview at Google " Sorry the above comment was mine ... Hello, I received a mail stating that " Someone at Google thinks you'd be a great fit here. We're looking at your skills and experience to see whether we have the right opportunity for you. In the meantime, to learn more about who we are and what we do, here are a couple of resources to give you a better sense of life as a Googler. Check out our Official Blog to stay up-to-date on our products and company news Peek into the day-to-day lives of Googlers on our Life@Google YouTube channel Browse our @Google Talks YouTube channel, full of visits from artists, authors and politicians Read up on how to best prepare for an interview at Google " I know this means that someone is really looking at my profile, but in an ideal case after getting this sort of a mail, how many days later will we get a call from the HR ?? Hi. I am the one who had his final round with the director scheduled and asked for hints. Now all the interviews are over. I got a mail that the interviews were productive and they require some documents. I sent them over and they are in the process of preparing the information packet. Could you give me a brief as to what would happen after this. Thanks for your help. Your post was quite helpful for me to get this far. Thanks a lot. Well, this means their local (India I presume) office has approved your candidature and they want to hire you. Now, they'll check the documents and make a pitch for you to their US office, where the merit of the case would be reviewed by one of the executives, and unless you've a very bad luck, you should get through. This process will take couple of weeks though. In the mean time, you can always ask any friend at Google (no matter where, which role) to look up your candidature status. For instance, it takes some time for them to prepare offer even after everything has been approved. Best of luck :) Thanks a lot buddy. Hoping I am lucky enough.. Let us know if you get the final offer :) Show more responses Heyy Query ... and Anonymous .... I just received a call and completed the HR Screening round and I have the next round with an Ops guy .. I use many of the Google Products but am still tensed. Any tips for the forthcoming rounds ?? Hi.. can you tell me what do they ask/check in the onsite interview at google office. Is it on the same lines as the previous interviews? any case studies or the same questions on risks related to different google products. Hey I am the one for whom the information packet was being prepared. I got the final offer :) But the basic+BOB was only marginally increased. But the promised bonus+shares was a big part of the compensation. It was a mixed feeling but I took the offer no matter what. After all, its Google :) I would be joining next month. Do u know if the hikes are good there. I know its performance based but on an average is it good? Yes, unfortunately that was the case for me too. The salary increase was marginal for me as well. Don't know about the hikes yet! Hey there, I have my first interview tomorrow with the recruiter who contacted me through mail, as far as i can see from the previous conversations in the thread this one is going to be a basic one and if good enuf will follow another one which will be a little detailed one?.. also could you please tell me what this interviewer will be be judging me on?.. and incase if i get through what will be the next round about? i'd appreciate if i can get an answer soon.. and @query if possible would you be able to disclose an approx figure of your salary??.. i mean what should I be expecting(i know its too soon to think about that when I havnt even given my frist interview) :P hey .. had my interview today.. next round has been scheculed.. 2 days from now.. he told me if this was a level 2 interview that would be a level 8 interview.. a bit tensed now.. could you please help me out Hi Query (one who got final offer), what is your work ex and did someone from senior management of google india speak to you in final round? if yes what did he ask and how you answered as I'm going to have one soon in final round. @ those who accepted the offer did u guys try negotiating? did they even entertain ur request for negotiations...fixed part is not that great...salary increase wud be only due t stcoks!!! No point trying unless you can show them you've a better offer from somewhere else :) after packet was submitted to hiring committee,the result was negative even when each interviewers had given positive feedback about me except the last interviewer who was from senior management. Disappointed with the result, it was more than 2 months process, all gone. :( Show more responses cont.. to mention i had 6 total rounds unlike to usual 4 rounds. It so happened that after usual 4 rounds (1 tele + 3 onsite after I provided documents and all which you guys say as 'go ahead ' from Google India) I was told that there is sudden shift in policy from head quarter and someone from senior mgmt will speak to me for 5th round and it went to 6th round where the feedback given was not supportive as per recruiter and I guess that led to negative final result by hiring committee. To anonymous who got the offer, I had my first round telephonic interview today...went well...the interviewer finally told me that i must be more specific and have to be a bit-more explanatory...he mentioned me that i am through to next round and asked me how much time i need to prepare? i told him 1 week...he told thats fine and i will have my 2-nd interview after 1 week...when will i get the mail regarding this?? also,give me a couple of questions u had faced in this round...help pls...anxious!! Hi... i had an interview that is first round as jam session in which, out of 20, only me and another girl got selected and recruiter told us to wait 2 to 3 weeks for next round, he also told to gain a brief knowledge abt Google services and products e.t.c. Here my doubt is its been two weeks still i have not received any call, mail nothing. will it take really this much time?cause for only second round its like i am waiting for ages...!! any help is greatly appreciated..!! Hey, So i have had all my rounds (including director) How long did you have to wait between the last round and an intimation to submit documents? (assuming all goes well?) I have call from recruiter yesterday regarding Program Manager position in Google. She told me that I have to come for f2f interview on Thursday morning. Can you please suggest me how should I prepare for it. It is going to be technical also "SQL" stuff. Plz let me know.. Heyy guys i have an hangout interview next week but my interviewer gave me a feedback saying" i was not good enough but i am putting u to the next round , you have to improve a lot "and he gave the same review for my 1st interview also that i had to improve a lot bt he was like il put you to 2nd round !! m clueless plz give tips for the hangout i knw about NDA bt just tips would be great Hey may I know the approx package you got for this position. Including bonus and stocks. Thank you I ve had 2 rounds of telephonic interviews.I have an onsite interview pretty soon at hyderabad office.Can someone give me a heads up/tips ? You mention "I had researched a lot and had a fair amount of knowledge anyway so I refrained from asking questions in a couple of interviews" - What do you mean by "fair amount of knowledge". What kind of knowledge did you have related to this position Hi all, I've got quite a long story and don't understand how to treat all this. I've got a message from HR through Linkedin for the same position about 2 weeks ago. At the same day I sent him over my CV and got back the question when it would be suitable for me to arrange a call. We decided to make it on Friday 15/11/2013, but i haven't got any call and was quite upset about it. In the evening of that day i send an email to sort out why there was no call, and got back appologize for missing it and again question about suitable time. ok, no problem! i told him that i have time on Monday 18/11/2013, but again neither got any response nor call! I really don't understand that recruiter... During the last week I also tried to contact him 2 or 3 times via email and Linkedin, but no result. Right yesterday I got a phone call without any arrangement, but as far as I was in gym - I missed it and noticed too late. Today I got an email from him about his unsuccessfull attempt and one more question 'when it would be suitable'. It's very funny so far:) I asked him to call be back today and... you won't believe... again no call and no messages! What should I do with this situation? Should I continue to disturb him or not? Don't like to leave the issues unsolved :( Show more responses Hi guys, Can anyone please help me what exactly do they focus on in interviews ? I have my interview in three days! What should one prepare? hey can you list down some questions that were asked specially the scenario and analysis types.that would help even at places other than google. |

Given a string "aaabbbcc", compress it, = "a3b3c2" . Given that output string's length is always smaller than input string, you have do it inplace. No extra space 23 Answerspublic static String cstr(String a){ if(a.length()<2){return a;} if(a.length()==2){if(a.charAt(0)==a.charAt(1)){return a.charAt(0)+"2";}else{return a;}} for(int i=0;i #include #include #include #define STR_SIZE 26 int main() { /* Current char sequence tracker */ char *c = NULL; char *b = NULL; char *str = (char*)malloc(STR_SIZE * sizeof(char)); if(NULL == str) return -1; memcpy(str, "aaaabbbcceeeeefffffff", 26); b = c = str; printf("Input: %s\n", b); while(*str) { if(*(str+1) != *str) // Repeat sequence ends { // Add 48 so the count gets printed as a char *(c+1) = ((str-c+1)+48); // Updated count, copy rest of the string starting after the count position memcpy(c+2, str+1, strlen(str)); // Update c to point to the new char repeat sequence c = c+2; } str++; } /* b was initialized to point to str up top, proving it was done in place */ printf("Output:%s\n", b); free(b); b = NULL; return 0; } String test="aavvvqwqaa"; int count=0,start=0,end=0; int length=test.length(); for(int i=0;i Show more responses Rohan: What if I give you the string "aaaaaaaaaa"? Your solution will print "a:", not "a10". in java, if you give me a String str="aaabbbcc"; you can't modify the str as all, then how can you do it in place? I assume I can go through the str, and store the new string such as "a3b3c2" anyone can explain to me? java inplace public void compress(char[] str) { if (str != null && str.length > 1) { for (int last = 0, curr = 1, count = 1, tail = 0; curr 1) { str[tail++] = str[last]; str[tail++] = (char) count; count = 1; } last = curr; curr++; } } } Need to delimit the array public void compress(char[] str) { if (str != null && str.length > 1) { int tail = 0; for (int last = 0, curr = 1, count = 1; curr 1) { str[tail++] = str[last]; str[tail++] = (char) count; count = 1; } last = curr; curr++; } str[tail] = '\0'; } } small correction - public void compress(char[] str) { if (str != null && str.length > 1) { int tail = 0; for (int last = 0, curr = 1, count = 1; curr 1) { str[tail++] = str[last]; str[tail++] = (char) (count + '0'); count = 1; } last = curr; curr++; } str[tail] = '\0'; } } This solution covers all cases.. http://justprogrammng.blogspot.in/2012/06/amazon-interview-string-compression-c.html Here is a recursive code which considers all cases... http://justprogrammng.blogspot.com/2012/06/amazon-interview-string-compression-c.html Try this.. it generates the desired output in Java /** * * @author Sourabh Mishra * Class which handles compression of a string replacing the occurrences of characters * with the character followed by its count in the input string * */ public class StringCompressor { /** * Method takes input as a string and replacing the occurrences of characters * with the character followed by its count in the input string * @param data String * @return */ public String compressString(String data){ StringBuilder outBuilder = new StringBuilder(); char prevChar = data.charAt(0); int counter = 0; char currChar; int length = data.length(); for(int i=0; i< length; i++){ currChar = data.charAt(i); if(currChar == prevChar){ counter++; // For the last unique characters if(i == length-1){ outBuilder.append(currChar); outBuilder.append(counter); } continue; } else { outBuilder.append(prevChar); outBuilder.append(counter); prevChar = currChar; counter=1; } } return outBuilder.toString(); } /** * @param args */ public static void main(String[] args) { StringCompressor sc = new StringCompressor(); System.out.println(sc.compressString("aaabbbcc")); } } An additional check and write inside in the else class is required to print the final unique character for inputs like "aaabbbh" public class Stringcompress { /** * Method takes input as a string and replacing the occurrences of * characters with the character followed by its count in the input string */ public String compressString(String data) { StringBuilder outBuilder = new StringBuilder(); char prevChar = data.charAt(0); int counter = 0; char currChar; int length = data.length(); for (int i = 0; i < length; i++) { currChar = data.charAt(i); System.out.println("Curr character is :" + currChar); System.out.println("Prev character is :" + prevChar); if (currChar == prevChar) { counter++; // For the last unique characters if (i == length - 1) { outBuilder.append(currChar); outBuilder.append(counter); } continue; } else { System.out.println("Prev character in else is :" + prevChar); outBuilder.append(prevChar); outBuilder.append(counter); prevChar = currChar; counter = 1; if(i==length-1) { outBuilder.append(currChar); outBuilder.append(counter); } } } return outBuilder.toString(); } public static void main(String[] args) { Stringcompress sc = new Stringcompress(); System.out.println(sc.compressString("aaaaaaadfgdfu")); } } public class Example1 { static String S1="aaabbbccc"; static String comstring=""; public static void main(String[] args) { System.out.println(" Actual string is "+S1); S1=S1+"#"; String oldString=S1; int count=1; for(int i=0;i Show more responses import java.io.*; import java.util.*; import java.text.*; import java.math.*; class amzone { public static void main(String [] args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=br.readLine(); int n=line.length(); int count=1; for(int i=0;i Using Ruby methods, ans = "" s.split("").group_by{|x| x}.each{|k,v| ans += "#{k}#{v.count}"} puts ans But this code snippet will produce "a4b3c2" for the input string "aaabbbcca" import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class StringCharCount { public static void main(String args[]) { String inputString="aaabbbccdddddddddddd"; List charUniqueList=new ArrayList(); Map charCountMap=new HashMap(); for(int i=0;i What about the input "abc"? I assume that should compress to "a1b1c1" which is NOT shorter than the input, so you cannot compress in place. string CombineWithNoExtraSpace(string S) { int n=S.size(),count=1,i=0; if(i==n) return "\0"; while(i+1<=n && S[i]==S[i+1] ) { count++; i++; } S = S[i] + to_string(count) + combine(S.substr(i+1,n-count)); return S; } def compress(in_string): final_string = "" init_char = "" ch_val = 1 for (i,ch) in enumerate(in_string): if ch is not init_char: init_char = ch if ch_val > 1: final_string += str(ch_val) ch_val = 1 final_string += ch continue ch_val += 1 try: out = in_string[i+1] except IndexError: final_string += str(ch_val) return final_string print compress("aaaaab") public String compress(String in) { if (in.length() 1 ? right-left : ""); right++; left = right-1; } return out.toString(); } public String compress(String in) { if (in.length() 1 ? right-left : ""); right++; left = right-1; } return out.toString(); } Answer: public class StringCompression { public static void main(String[] args) { String inputString = "abcabcaaaaaaaaaaaaabc";//"aabcccccaaa"; System.out.println(getCompressedString(inputString)); } private static String getCompressedString(String originalString) { StringBuilder compressedStr = new StringBuilder(); if(originalString != null && originalString.length() = originalString.length()){ return originalString; } else{ return compressedStr.toString(); } } } public static String returnCount (String values) { HashMap getHash = new HashMap(); StringBuilder sb = new StringBuilder(); // char[] charsInString = values.toCharArray(); for(char characters : values.toCharArray()){ if(!(getHash.containsKey(characters))){ getHash.put(characters,1); } else getHash.put(characters,getHash.get(characters) + 1); } // for() for(char keys : getHash.keySet()){ sb.append(keys); sb.append(getHash.get(keys)); } System.out.println(getHash); return sb.toString(); } |

Assume a matrix of integers they are sorted in boh row and column vice .. how do u find a given number from the matrix in a optimal way? 10 AnswersLet the matrix is n*m matrix. Then O(n log m) solution is trivial (binary search in each row). There is a easy O(n+m) solution too. The idea is to start from upper right corner (mat[0][m-1]) and traverse toward lower left corner (mat[n-1][0]). On the way check each entry and depending on whether larger go left or down. If there is a solution you will find it on the way. Or you will arrive to a point where you can no longer move without going out of the matrix. Either way you will check at most O(n+m) entries thus the solution in O(n+m). I think it could be done even better than in O(n+m). Instead of starting at the upper right corner do a binary search on last column and find the biggest element that is still smaller than the given number. Say it's gonna be A[i, m-1]. Now we could throw away all rows up to an including i (since A[i, m-1] is larger than all of these elements) and the last column. Repeat everything for a smaller matrix of size (n - i, m - 1); To elaborate a little on dp's idea and add my take on it I would do a binary search on the last column to find the interval where the number is in. This interval will be one row within the matrix (assuming the value is not in the last column) and to find the interval should be O(log n). Then I would do a binary search on the row that remains which should cost O(log m). Combined that would be O(log n) + O(log m). Let me know what you guys think of this solution. Show more responses Anonymous, consider the matrix and you are searching for 9. Using this new algorithm we would look at rows 2 and 3 since 8 < 9 < 10 and completely miss 9 in the last row. (1 3 5 7) (2 3 6 8) (3 5 8 10) (6 9 11 12) dp, what do you do if the first element in the last column is already larger than the target? I.e. there may be no number that is smaller that the target. You could throw away that column, but that's it, I think. If so, the worst case becomes O(m). What if you did a binary search on the diagonal.... A better solution than O[log(mn)] is unlikely. An mxn array can be laid in memory as a m*n one dimensional array at its base form. So a matrix sorted by row and column simply means this mxn one dimensional array is sorted. A binary search will get you the result in O[log(mn)], that is the fastest solution available. How about this. for m columns - do binary range_search. As in, start with m/2 th column, if the number is in this range...col(0) O (log(m+n)) oops, there is a catch.... If the number is in a range, it can be in that column, or any of the columns towards left of it....and in some cases, if its in the range.. it can still be on any columns on right..... need to tweak a bit more. Ok writing this 3rd time , no one will see this but for the sake of it, Using radix sort Take 10 buckets and enter all numbers respectively. For example all numbers unit digit with 9 will in 9 number bucket. Just divide the given number (input) and into parts , using mod operator. And using the divided number"s unit digit find that index in the bucket. Tada . Radix sort way the. Linear search way to find the number Complexity O ( n ) Phew |

### Program Manager at Microsoft was asked...

Consider a lift lobby where people are waiting for the lift. Now when lift arrives people get in irrespective of who came first. Thus, the person who came first keeps waiting and others keep getting in. Design a lift system which can solve the problem of this person. 15 Answersincrease the load capacity of lobby by its size andhaving a narrow path in front of lobby so that the person who came first can only enter first, just like we stand for ticket in railway station. a.)If you are talking about the technical customization, HAVE A ELEVATOR INSTEAD OF LIFT. Regards Vishnu 9884578010 install a camera with face recognition near the external button system, system scans the face of the person and stores, when the lift comes, there is a face recognition system too.. the persons can only move in the lift in the sequence of arrival in the lobby and subsequent face scan ... if the person who came first, gets his face scanned first does not get to move in the lift first .. instead an other person moves and tries to get his scan ratified ... system would throw a voice messege ... pls let the person before you in the que come first!!!! Show more responses I don't find any of the answers posted above by Vikram, Vishnu or Deb as appropriate! @Vikram: Can you increase the size of a lift lobby??? FYI a lift lobby is the space u generally have between an array of lifts located on opposite sides of a wall. Having a narrow path and having a long waiting queue?? Imagine such a situation in an office or a shopping mall or an apartment! and will u demolish an existing building to reinstall this design u are suggesting - who will buy ur design? @Vishnu: Elevator - do u mean escalator? Imagine a 30-40 floor building and and escalator going 30 floors up and down! Think of the time u will have to take to reach the top floor. There can be n types of solution, but it is important to evaluate every solution. we are not suggesting just an alternate solution, but addressing the users problem. I think we are increasing his problem by this design. And also consider the technical feasibility of such design in say 50 floor building? and again will u demolish an existing building to reinstall this design u are suggesting - who will buy ur design? @Deb: Again, we are solving the users problem here and not just suggesting solution for the sake of it. Imagine such a lift system installed in your apartment complex! The camera would know that you are no. 7, how would you know that? not knowing this you will try to enter a lift and then u say that the lift will stop u!!! and there may be 6 lifts in the lobby. Say at a particular instance of time 2 lifts - lift 1 (going down) and lift 4 (going up) arrive. you will not let in person no 10 who wants to go down while all other 9 who came before and wants to go up. And how would the camera know which floor the person wants to go?? I am just giving pointers and this is the way the options will be struck down, if they do not address the actual problem/ or you do not consider the feasibility of implementation. The solution that i gave was this: When one enters a lift lobby first thing he does is to press up or down button to call a lift going up or down respectively. Once we enter a lift we have the keyboard to press the floor number inside the lift. What i suggested is to have a similar keyboard somewhere at the entrance of the lift lobby along with a small embedded display screen. So that when i am entering the lobby i press say 11 (to go to the 11th floor). While i press that, instantly the lobby shows me the lift number (say Lift 1, 2, ..6) i need to get into. So i know which lift i need to get into and i will obviously stand in front of that lift. At any time, the same lift number will not be issued to more than X people (where X is a predefined number of persons who can go in a lift at a time). Here the design is not in reinventing the entire lift system. Nobody will incur so much real estate cost to scrap the existing lift system and build a totally new designed one! The actually design here would be to build the backend logic that the lift system would use to assign the right lift number to every arriver in the most efficient way. e.g. Assume a simple start state (for a 2 lift lobby) when all lifts are stationary at the ground floor. When P1 (going to F10) comes System assigns him L1. For P2 (F5) assigns L2. Now to P3 (F12) assign L1, P4(F11) assign L1, P5(F4) assign L2 and so on. This is a simple situation. All we need is an algorithm which can address this lift assignment in the most efficient way. I WAS SELECTED :) The lift system you described is one they use in a large hospital close to where I live. I think they did it so that you would not have to press buttons inside the lift and not for the particular problem described in the question. Have a two way door opening in the lift. But always entry should be in one side and exit other side. Sorry for my previous response. Wrongly understood the question @Anonymus (One who posted this question): I see two major flaws in this solution. 1) If a group of people wants to go to the same floor together and only person among the group presses the button, then the lift under this system would assume that only one person would enter and allot only 1 person's capacity to the entire group, thus exceeding the capacity frequently. Under this system, every individual would have to press the button even if they come together which is a bit of an inconvenience I feel. 2) Also, if someone presses the button, is allocated a lift and then doesn't enter, then the lift wont know and will not 'free' the capacity leading to it running under-capacity when there are other people waiting to use the lift. IMO there should be a token vending machine just outside the lift where as and when people come, take out token. Now these tokens are embedded with a single chip with a kind of dynamic number saved on them. The vending machine would draw out tokens in a numeric sequence, once a person enters a life he would have to punch/drop his token into a reading device which will open the gate for the lift in a particular order. Once all are done, the machine would be reset and again the procedure can be repeated for the next set of people. This is something similar to Metro Train Tokens. Create a queuing system with barricades, just like at airport ticketing counters. What's the problem here i can't find it ? increase the no of lifts to serve for peak periods. Decrease the width of lift doors. enhance the lift algorithm to serve better. Try to control the flow, by analyzing the causes. Keep a notice board or appoint a security , if required. It was not mentioned i the question that there are several lifts in th lobby. Hence, it a very simple solution for the first person to enter first is to arrange a baricade- Q system. Thats it....age old and very simple, price less solution. Show more responses One way can be to have a id card scanner installed in the lift area. Since it is an office it is safe to assume that people will be having their id cards. When people come to the lift they scan their id cards, there can be a tv screen next to the lift which can show the order in which people have arrived. In my view , This is not any technical issue we are trying to solve, problem is rooted through people discipline. Install cc cam and publish few lift lobby disciplines, make sure violation of rules will be consider as HR escalation. I am sure this problem will be corrected without any huge technology investment. With this approach two benefit I can see : Huge R&D investment can be saved. If we could correct People behaviours that will be a permanent fix for the many other initiatives. If the question is asked to measure a person's reasoning and interviewer expecting a solution through some logical technology initiation , selected candidate has given a reasonable answer of course a complex algorithm need to be develop with all permutations and combinations along with pros and cons, still it is possible through embedded technology. |

Given an array of numbers, nums, return an array of numbers products, where products[i] is the product of all nums[j], j != i. Input : [1, 2, 3, 4, 5] Output: [(2*3*4*5), (1*3*4*5), (1*2*4*5), (1*2*3*5), (1*2*3*4)] = [120, 60, 40, 30, 24] You must do this in O(N) without using division. 13 AnswersWell my answer was to divide the array in 2 different parts perform some logic and in end multiply both the arrays One solution would probably be to go through entire array once, keep a track of total product, and then in another loop populate result array by setting each index as totalProduct / (value at index in argument array) oh.. but without division. Didn't see that part with my tiny browser Show more responses If you were not supposed to divide the array into two, for processing.... import java.util.*; class aNum2{ public static void main(String[] args){ int[] a= new int[5]; int[] b= new int[5]; a[0]=1; a[1]=2; a[2]=3; a[3]=4; a[4]=5; int j; for(j=0;j<5;j++){ int i; int p=1; for(i=0; i<5; i++){ p=a[i]*p; } b[j]=p/j; } System.out.println(Arrays.toString(b)); } } if you werent supposed to use the division operator : import java.util.*; class aNum{ public static void main(String[] args){ int[] a= new int[5]; int[] b= new int[5]; a[0]=1; a[1]=2; a[2]=3; a[3]=4; a[4]=5; int j; for(j=0;j<5;j++){ int i; int p=1; for(i=0; i Please ignore the very first response .. there is a correction on line 20 If you were not supposed to divide the array into two, for processing.... import java.util.*; class aNum2{ public static void main(String[] args){ int[] a= new int[5]; int[] b= new int[5]; a[0]=1; a[1]=2; a[2]=3; a[3]=4; a[4]=5; int j; for(j=0;j<5;j++){ int i; int p=1; for(i=0; i<5; i++){ p=a[i]*p; } b[j]=p/a[j]; } System.out.println(Arrays.toString(b)); } } trick is to construct the arrays (in the case for 4 elements) for example { 1, a[0], a[0]*a[1], a[0]*a[1]*a[2], } // productsBelow { a[1]*a[2]*a[3], a[2]*a[3], a[3], 1, } // productsAbove then multiply productsBelow and productsAbove http://stackoverflow.com/questions/2680548/interview-q-given-an-array-of-numbers-return-array-of-products-of-all-other-nu #include using namespace std; int main(){ int a[4] = {1,2,3,4}; int b[4] = {1,1,1,1}; for(int i = 1 ; i =0; i--){ prod *= a[i+1]; b[i] *= prod; } for(int i = 0; i < 4; i++){ cout << b[i] << " " << endl; } } public class Example2 { static int[] Numarray={1,2,3,4,5}; public static void main(String[] args) { ArrayList arr1=new ArrayList(); int first=0; int count=1; for(int j=0;j<=Numarray.length-1;j++) { for(int i=0;i There should be no divsion of array not even numbers so the solution goes like this //SIMPLIFIED APPROACH class amazon2 { public static void main(String rags[]) { int []a={1,2,3,4,5};//any digits as per approach int []b=new int[10]; int []c=new int[10];//dummy integer array for(int i=0;i public void printProduct(int[] a) { int[] b= new int[a.length]; for(int j=0;j public void printProduct(int[] a) { int[] b= new int[a.length]; for(int j=0;j prodSum = function (arr, memo, index) { if(index >= arr.length){ return; } for(var i=0; i |

### Senior Software Engineer at Amazon was asked...

You are given a fixed number of 5 rupee, 10 rupee, 20 rupee and 50 rupee stamps. Now given an amount for sending a parcel, you should design an algorithm to come out with the minimum number of stamps that should be used for attaining that amount. For example, if the parcel costed 30 rupees, it could be attained using one 20 rupee stamp and one 10 rupee stamp OR using three 10 rupee stamps OR using one 20 rupee stamp and two 5 rupee stamps OR using one 10 rupee stamp and four 5 rupee stamps OR using two 10 rupee stamps and two 5 rupee stamps. However, the minimum number of stamps is the case of one 20 rupee stamp and one 10 rupee stamp where only two stamps are used. The case where no solution is possible should also be handled, for example, a parcel amount of exactly 33 rupees cannot be attained. 8 AnswersThe solution is attained using dynamic programming. The basic idea is that the minimum number of stamps used for attaining an amount x, is 1+minimum of (minimum number of stamps for attaining x-5, minimum number of stamps for attaining x-10, minimum number of stamps for attaining x-20,minimum number of stamps for attaining x-50). You can try to solve this first by assuming that an unlimited number of 5 rupee, 10 rupee, 20 rupee and 50 rupee stamps are available. And then you can take into account that only a fixed number of these stamps are available. And what is the time involved to get this done? I really liked the question.Simple to read but involves good amount of logic. I ve written down the algorithm but i believe i took more time than i initially thought i would take. I understand what the interviewer is trying to test and I know how to solve it, but what about more realistic scenario where parcel postage cost would be beyond given values like 3 units of currency or 37 units of currency. Show more responses In this specific case, dynamic programming is overkill. There's a better optimal substructure here: The stamp with greatest value less than parcel cost minus stamp values already committed minimize the total of stamps. 1. find the stamp <= cost from highest stamp cost 2. num of found_stamp = found_stamp/cost, rem_stamp = found_stamp % cost 3. Do 1, then 2 until rem_stamp ==0 (done) or rem_stamp < least stamp available (not possible case) In the previous ans, after step 3 if rem_stamp !=0, go back to step 1, find next_stamp < cost (but smaller than value of found_stamp in previous iteration) i=0; boolean solPossible = false; do { if(cost % notes[i] == 0) solPossible = true; else i++; } while(!solPossible && (i void sendParsal(int cost) { int[] avlstm={50,20,10,5}; int i=0; while(cost>=5) { while(cost>=avlstm[i]) { System.out.println(avlstm[i]); cost=cost-avlstm[i]; } i++; } if(cost!=0) { System.out.println("Solution not possible."); } } |

out of 25 horses select the fastest three in minimum number of races where in each race there would be exactly five horses. 10 Answers6 races i think it could be 6 races... first five races taking 5 horses each,and then the 6th ace taking the 1st horse of each of the previous race,den select the fastest three among them. would be 5 races if a stop watch is given..... however solutions given before are wrong since the horse coming 2nd in the first race might be faster than the horses that come first in the subsequent race :) hence we have to assume that a timer is provided Show more responses umesh no timer has been provided and it would be 7 races :) 11 races First 5 races taking 5 horses in each race. Next 5 races taking in each race horses which have come first, horses which have come second, third, fourth and fifth....... Final 11th race out of 5 which have won in second set of races to find fastest 3 6 Race would be wrong answer. What if in one group all the 5 horses are fastest of all others. Then from first round of 5 races we might lose those 2nd and 3rd ones. My answer is also 11 Races. Round one - 5 Races -------------------- Including all 25 horses. 5 each race. Left with -> 15 horses [Take 1st,2nd & 3rd from each race. Which would be total of 5*3=15 horses.] Round two - 3 Races [ Grouping any 5 of 15 horses left] ------------------- Left with -> 9 horses [Take 1st,2nd & 3rd from each race. which would be total of 3*3=9 horses.] Round three - 1 Race. ---------------- Take any 5 horses of 9 horses left Left with -> 7 horses 3 (1st 2nd and 3rd) + 4 (remaining ones) = 7 horses Round four - 1 Race. ---------------- Take any 5 out of 7 Left with -> 5 Round Five - 1 Race ---------- Race of 5 horses left 7 races: Split the 25 into 5 groups and make them race, this would be 5 races. Take the fastest horse of each group and make them race (6th race). Let's label the initial group of the top 3 horses of the 6th as a, b, c. The possible candidate for the 3 fastest are: a[1], a[2], a[3], b[1], b[2], c[1] We just need one last race to determine the top, the race would be between a[2], a[3], b[1], b[2], c[1]. The final result is a[1] then the top 2 of the 7th race. Easy: Correct answer is 11 but much easier method: 1. One race among 5 horses to find the fastest 3. 20 horses left not raced yet. 2. Now keep the 3 fastest horses you found and add two other horses out of 20 horses left to the race, again select the fastest 3. 3. Keep doing this for all 20 horses by selecting 2 of the horses left to race against the fastest 3 always. 1 race (to find the fastest 3) + 10 races (20/2 races to test all other 20 horses) = 11 races Constant Time - 7 Races 5 Races among 5 each. 6th Race for all third place holders 7th Race for Winner of sixth race +two people who defeated him in 1st race + two people who defeated the second place winner in 6th race. Best Case - 6 Races (3 place winner of 1st race against other 20 and he wins all the time) Worst Case - 11 Races( Make the fastest 3 of each race run against the other 2 each time) |

### Program Manager at Google was asked...

what is angle between hour hand and minute hand in clock at 4:20 ? what is biggest conflict management you have handled in your work place 11 Answers4:20 - ANGLE WOULD BE 120 CIRCLE IS 360 DEGREES , EVERY 5 MINUTES = 30 DEGREES IF min's hand rotates for 360 deg, hr's hand rotates for 30 deg - so for 60 min - hr's hand rotates for 30 deg. For 1 min it rotates for 0.5 degree. Hence, for 20 min it rotates for 10 degrees. The angle between hr's hand and min's hand should be 10 deg. have you ppl looked at an analog clock recently it is 0 or 360 degrees Show more responses The angle between hour and minute hand in 4:20 is 10 degrees. For a minute, the hour hand rotates by 30/60 = 1/2 degrees. hence, for 20 minutes it rotates by an angle of 20*1/2 = 10 degrees. The formula is 180 - | 180 - | m * 6 - (h * 30 + m * 0.5) | Heres the complete formula.. for better understanding.. ABS is absolute value 180 - ABS (180 - ABS ( m * 6 - (h * 30 + m * 0.5) ) ) An analogue clock is degrees. 360/12=30 degrees per hour 360/60=6 degrees per minute So for 4 hours - 30*4=120 degrees For 20 mins - 20*6=120 degrees therefore, Answer is zero 20 minutes is 1/3 (20/60) of the way around the dial, 4 o'clock is also 1/3 of the way around a clock (4/12), so they are perfectly aligned and the angle between them must be zero. There are two approaches to this question: - If you assume the hour hand stays put and only moves every hour o'clock (which is a simplification, but a reasonable one), then the angle is 0º. - If you assume the hour hand rotates at a constant angular speed, then the answer is 10º. Since there's 360º / 12 = 30º between hours: + The minute hand points at 4. That's 30º x 4 = 120º. + The hour points slightly past 4. Since a third of the hour has passed (20' = 60' / 3), then the minute hour has moved a third of the way between hours. Hence the hand is at 120º + 30º / 3 = 130º. The difference between the two hands is 130º - 120º = 10º So I guess you get some poits for saying 0º, more points for saying 10º. My question is, did you get to use pen and paper, or you had to answer on the spot? in every 60 minutes hour hand moves 30 degrees. so at 14:20 ( it means that 20 minutes have past since last turn) hour hand moves 20*30/60 = 10 degrees so the answer is 10 degrees... 360/(12*3) = 10 |

### Business Analyst at Amazon was asked...

How many smaller cubes are completely invisible in a n*n*n rubic's cube? 7 Answersn^3- 6n^2 The number of cubes are n^3(volume). The number of cubes exposing one or more sides( 6 *( n^2) - all cubes on the sides.) Number of invisible cubes are n^3- 6n^2 . Isn't the answer none since the question says "completely invisible"? every unit is visible by at least one side so any sub cube (made of these units) has a portion exposed. N*N*N-(N*N*2+N*(N-2)*2+(N-2)*(N-2)*2) Show more responses (N-2)^3 (n-2)^3 you can verify by assuming n=4. Try to visualize invisible cubes and compare it with answers. (n-2)^3 you can verify by assuming n=4. Try to visualize invisible cubes and compare it with answers. (n-2)*(n-2)*(n-2) |

how much is 12*28? 6 Answers336 336 336 Show more responses 0.42857 336 28*12 |