# Interview Questions in Irvine

interview questions shared by candidates

## Interview Questions in Irvine

### Associate Analyst at Gallup was asked...

What do you think about when you are alone in your car? 35 Answersgetting out I evaluate design work I have done for clients to see if its ideal or needs to be perfected. I try not to be distracted and pay attention to the road. Show More Responses I hope I will never have to work at HR and have to create smart unexpected questions. The fact that because no one will hire me I'm so in debt that the only way out for my family would be for me to drive off that overpass so they can cash in on the life insurance since apparently I'm worth more dead than alive. Why the hell is the dipwad in front of me driving 10 miles below the speed limit and not using his turn signal? I don't think about anything - just driving, because I want to come by my car, not by ambulance. My family, the music or programs on the radio, and story ideas. How crazy life would be if I didn't have a driver's license. Where are the cops? Driving. Get the job, get the job, get the job "I hope nobody catches me." Show More Responses I don't have a car. Which exit do I need to take to get away from Sallie Mae forever? Must thought "would have been better if some one accompanied in car" I just try to concentrate on road while driving. Life is wonderful.live it once by safe driving.The power is in present moment. I wonder what it's like to be a bird I wonder how long it will be before that body in my trunk starts smelling. Sex. Do you want me to go into more detail on that? There's no backseat driver, I am free. about my destiny Show More Responses wheres my chauffeur? He ought to be here now.. how i am different frm other and what should i do to make it About the escape plan if someone attacked me when the doors are closed. :P nothing specific nothing I would be thinking about Flo, from Progressive Insurance, and how many ways to get rid of her fat behind. Drop her off at an all you can eat buffet, and call it a night? Make her one of Revlon's makeup models, and watch their stock drop? Her hitting on the plumber, under the cabinet, and wonder who has the bigger plumbers crack? Take her water skiing, and watch her start a Tsunami? Maybe watch her dance to a song like, "I like big butts and I cannot not lie......." by Sir Mix-A-Lot? Gotta Go..............Beep-Beep, Beep-Beep, Beep-Beep (Flo doing Michael Jackson's moon walk)? it depends at present wtz in my mind... and i cant sit more time freely in car. or hearing by the music i wil be in an enjoyable mood it depends... Its depending upon the mood at that moment........ I spend my time driving to plan my day or recap my day depending on the time. I also rehearse conversations I anticipate may be difficult and try to anticipate responses. On really long drives, I'll listen to books on Audible or practice my Portuguese with language tapes. But if the weather's good, and I'm in the right mood, I'll just open the sunroof and blast Hendrix or he Clash and sing along. Ouch! That BUG will never have the GUTS to do that again! Show More Responses How would be my next map in Portal 2. I'd be thinking... what next........ what do I need to do next! |

Write a function that finds the median of a set of three numbers, also find the Big O. Can it be done with only 2 comparisons, or do you need 3? 11 AnswersPick two numbers: A and B, Add the third number to each of the first two : (A+C), (B+C). Compare these two numbers and take the lesser of the two. Now compare C with the other member of the less number. The greater of these two is the median. I'm not following. Is this: say, B+C is less than A+C, then the larger of B and C is the median? If so, isn't this a counterexample: A = 2, B = 1, C = 3? Actually the answer is the next one: we could have an answer using only two comparisons. The main idea is that we need to examine one of the numbers to get into the segment created by the other two numbers. And another important thing is that one comparison could be used to definitely determine for both two segments created by two numbers. For example we are trying to examine number A and we have two segments formed by B and C numbers: [B; C] and [C; B]. But considering that for determining if A is in the segment created by B an C we need to make the following comparison: (A - B) * (C - A) >= 0. It is easy to notice that if A is in segment [B; C] (B is less or equals to C) we have both multipliers are positive but in an opposite case when A is in segment [C; B] (C is less or equals to B) we have both that multipliers are negative. If former comparison is negative - then number A is not in any of segments [B; C] or [C; B]. And here is a code of function on C/C++: int medianOfThreeNums(int A, int B, int C){ if ((A - B) * (C - A) >= 0) { return A; } else if ((B - A) * (C - B) >= 0) { return B; } else { return C; } } Show More Responses if (B-A) > 0 if (C-B) then B else C else if (C-A) > 0 then A else C a=b=c ? First get two numbers: x = a - b y = a - c now there are four possible cases for x and y if x & y are both positive => a is bigger than both b and c.=> choose bigger of b & c if x & y are both negative => a is smaller than b and c => choose smaller of b & c if x is positive and y is negative => a is bigger than b but smaller than c => choose a if x is negative and y is positive => a is smaller than b but bigger than c => choose a void GetMedian(int a, int b, int c) { int small, large; if (a < b) { small = a; large = b;} else {small = b; large = a;} // Check where c lies: if (large < c) return large; else if (c < small) return small; else return c; } @Moy: if the answer turns out to be small, then haven't you done 3 compares? Running Vitalii's code with a = 1, b = 7, and c = 3 produces a median == 7, which is incorrect. Suggestions? Vitalii's solution works for me. def find_median(a, b, c): ab = b - a bc = c - b if -ab * (ab + bc) >= 0: return a if ab * bc >= 0: return b return c can't you sort the 3 numbers, the median is the middle one...? |

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

Phone interview question: Given a string pattern of 0s, 1s, and ?s (wildcards), generate all 0-1 strings that match this pattern. e.g. 1?00?101 -> [10000101, 10001101, 11000101, 11001101]. You can generate the strings in any order that suits you. 12 Answerspublic static void generateAllPatterns(String s, int index) { while(index < s.length() && s.charAt(index) != '?') index++; if(index == s.length()) { System.out.println(s); return; } StringBuilder s1 = new StringBuilder(s); s1.setCharAt(index, '0'); generateAllPatterns(s1.toString(),index); s1.setCharAt(index, '1'); generateAllPatterns(s1.toString(),index); } public static void generateAllPatterns(String s) { generateAllPatterns(s,0); } {{{ public static ArrayList getAllString(String str) { if(str==null) return null; int index = str.indexOf('?'); ArrayList res = new ArrayList(); if (index == -1){ res.add(str); return res; } char ch1[] = str.toCharArray(); char ch2[] = str.toCharArray(); ch1[index] = '0'; ch2[index] = '1'; res.addAll(getAllString(new String(ch1))); res.addAll(getAllString(new String(ch2))); return res; } }}} #include #include void findBinPattern(char *data, int i) { if (data[i] == '\0') { printf("%s\n",data); return; } if (data[i] == '?') { data[i] = '0'; findBinPattern(data, i + 1); data[i] = '1'; findBinPattern(data, i + 1); } else findBinPattern(data,i+1); } int main(void) { char data[] = "?1"; findBinPattern(data,0); return EXIT_SUCCESS; } Show More Responses Here's a verbose non-recursive solution that can be traded for some of the solutions above (always think about a bad input like ??????????????????) public void generatePatterns(String str) { // Let's assume an incoming input of 1101?0010?1111? // This means we will have 2^3 = 8 combinations // Let's sweep through the input once and identify the number of wildcards // Once you have the number of wildcards you can generate the permutations Ex: 3 wildcards, clearly my list is 000, 001, 010, 011 etc int ctr = 0; for(int i=0; i permList = getPermutations(ctr); ArrayList patterns = new ArrayList(); for (int x = 0; x getPermutations(int ctr) { ArrayList perms = new ArrayList(); String perm = null; int totalPerms = (2 << (ctr - 1)); for(int i =0; i I like my recursive version the best. public static Set allSets = new TreeSet(); public static Set getAllCombos(String str){ if(str == null){ // Error Check return null; }else if(!str.contains("?")){ // Base Case allSets.add(str); return allSets; }else{ getAllCombos(str.replaceFirst("\\?", "0")); getAllCombos(str.replaceFirst("\\?", "1")); } return allSets; } public static void PossibleStrings(String str) { if (str == null) return; else if (str.Contains("?")) { int findex = str.IndexOf("?"); str = str.Remove(findex, 1); PossibleStrings(str.Insert(findex, "1")); PossibleStrings(str.Insert(findex, "0")); } else Console.WriteLine(str); } Dynamic Programming. Create an arraylist that will store intermediate results. Start from end of string. If a 0/1 is encountered, simply append the character in the beginning to all the elements in result array. If a wildcard is encountered, add both 0 and 1 to all the elements.This pass will double the number of elements on the arraylist. Repeat till the first element is reached. Output the result. Well, things are usually easier in python :) def print_wild_string(s,pos): if pos == len(s): print s return if s[pos]=='?': new_str_0 = s[0:pos] + '0' + s[pos+1:] print_wild_string(new_str_0,pos+1) new_str_1 = s[0:pos] + '1' + s[pos+1:] print_wild_string(new_str_1,pos+1) else: print_wild_string(s,pos+1) An even shorter / cleaner python version: def replaceWildcards(str): if str.find("?") < 0: print str else: replaceWildcards(str.replace("?", "0", 1)) replaceWildcards(str.replace("?", "1", 1)) (full disclosure: I did a few tests with the timeit library and the previous python solution is 20% faster than this one, so if time is your major concern, go with the other python solution. Actually, that solution but replacing the "+" for string concats with "".join() format was 5% faster than the original above if you really wanted to optimize.) void Gen(String pattern){ int n = pattern.length() - pattern.replace("?", "").length(); int[] locs = new int[n]; int count=0; for(int i=0;i C# version: public static void GenerateAllPatterns(string input) { if(string.IsNullOrEmpty(input)) { return; } int index = input.IndexOf('?'); if(index > -1) { // From the input string, create two new strings // which have the ? converted to both a 0 and a 1. char[] c1 = input.ToCharArray(); c1[index] = '0'; char[] c2 = input.ToCharArray(); c2[index] = '1'; // Recursively call this function on the two new strings. GenerateAllPatterns(new string(c1)); GenerateAllPatterns(new string(c2)); } else { Console.WriteLine(input); } } void printChars(string s, string soFar) { if(s.size() == 0) { cout< |

### Test Engineer at Broadcom was asked...

Given Vcc and 2 capacitors A and B in series to ground, what is the voltage in between 4 AnswersSomewhere in between Vb=(Cb/Ca+Cb)V I mean Vb=(Cb/(Ca+Cb))V Show More Responses It depends on the initial condition.... if both capacitors were discharged to 0V at first, and then one side is charged to Vcc, then the answer would be Vb=(Ca/(Ca+Cb))Vcc Vcc---Ca----Cb----gnd However since there was no initial conditions given , the middle voltage could be anything if the capacitors are ideal |

If you had a savings account with $1, at a 100% interest rate, at what year would you have 15 billion dollars? 4 AnswersUse the power of 2's to get to the answer. Log base 2 of 15 billion You should know offhand that 2^10 is 1024, so 2^20 = 1024^2 is approx a million, 2^30 is approx a billion, then you need four more years to get to 16 billion. Remember that you started with 1, not 2, so the answer is 35 years, not 34. Show More Responses After 34 years you would have 16 billion. That is to say, you would have 15 billion in the 34th year. |

### Personal Banker at Wells Fargo was asked...

what do you think is the most important part of sales 5 Answersfollow up Others that would be good, Selling yourself and Building rapport or "Clicking" with the client Making sure the client is satisfied and walks away with a positive impactful experience (for referrals and retention). Show More Responses Listening to the customer and understanding their needs to be able to offer a complete solution of services that ties back and makes sense for the customer Being able to help the customer with efficiency, respect and patience |

### Area Coordinator at Waypoint Homes was asked...

What are you salary requirements? 4 Answersi have an interview for the acquisition analyst position in AZ, is there any assessment test you have to take? and do they do background,education check and drug test? any help would be greatly appreciated, thanks. Yes they did make me take an assessment test that is pretty thorough. They also do a full background check, drug test, and credentials. Thank you very much for the quick response, i appreciate that. Show More Responses Do they hire people with class b misdemeanor? |

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

Get the kth largest number from two sorted arrays 3 Answerslet they be a[m]&b[n] int i,j,p=0 for(p=1;p // return kth biggest element from 2 sorted arrays public static int kthElement (int[] a1, int[] a2, int k){ int i1 = a1.length-1; int i2 = a2.length-1; for (int i =1; i a2[i2]) { i1--; } else { i2--; } } if (a1[i1] > a2[i2]) return a1[i1]; else return a2[i2]; } the solutions 1) start looking for the arrays a1 and a2, as they are both sorted. you can move ahead when needed. This solution is O(k). the same as implementation on the above 2 implementation. 2) The interviewer is probably looking to find the following answer. lets say for choosing the k element you choose l element from array a1 and k-l element from a2. the condition to be satisfied here is a1[l] |

Write an application that maps out a large set of data in as little time as possible. 3 AnswersThe right answer was a parser that adds things to a map, and evaluating the map as you went for duplicates. I actually did not get the answer. Can you explain yourself better? What is a large set of data? Nowadays, we have solutions such as MapReduce to handle data intensive problems. See: http://en.wikipedia.org/wiki/Data-intensive_computing. For not so large dataset, you can use a simple map (as HashMap in Java) to store each partition of information. |

### ASIC Design Engineer at Broadcom was asked...

how to generate a clock divide by 3 4 AnswersAssuming that input clock is square wave and 50% duty cycle, Method 1: Clk / 3 is equal to Clk / (6/2). this means fist divide by 6 and multiply by 2. dividing by 6( use two DFF(D is tied to Q_b and it is connected to clock of 2nd DFF). multiplying by 2( create some delay and XOR the two signals(the signal after dividing by 6 and its delayed signal), But it's hard to make the output clock have 50% duty cycle due to precise delay control. so alternative method 1 is first multiply by 2 and divide by 6. Method 2. Use 2 edge counters(one for rising edge and the other for falling edge) draw the state machine that goes (back) to toggle state when both counters become 2. Sorry, Method 1 is incorrect. the possible method 1 is to delay the input clock and XOR the input clock and its delayed one(delay doesn't need to be precisely half period of input clock, which is good) then use a single rising edge counter to toggle when it counts 3 rising edges. this is glitch-free Please refer to: http://www.eetimes.com/document.asp?doc_id=1202359 Show More Responses Sorry above is wrong link. correct link: http://vlsiwizard.blogspot.com/2008/01/design-clock-divide-by-3-circuit-with.html |