Senior Software Engineer Interview Questions in Palo Alto, CA | Glassdoor

# Senior Software Engineer Interview Questions in Palo Alto, CA

"Senior software engineers are the most experienced member of a software team and usually carry the most responsibility and authority of that team. Because of this, interviews will be designed to find candidates who have expert knowledge of the field and years of experience as a software engineer. Expect to be asked tough technical questions and to give examples of previous projects that you have worked on."

## Top Interview Questions

Sort: RelevancePopular Date

Jul 18, 2010
 Write some pseudo code to raise a number to a power.11 Answerspretty trivial...int raise(num, power){ if(power==0) return 1; if(power==1) return num; return(raise(num, power-1)*num); }double Power(int x, int y) { double ret = 1; double power = x; while (y > 0) { if (y & 1) { ret *= power; } power *= power; y >>= 1; } return ret; }Show More ResponsesIn Ruby: def power(base, power) product = 1 power.times do product *= base end product end puts "2^10 = 1024 = #{power(2,10)}" puts "2^0 = 1 = #{power(2,0)}" puts "2^1 = 2 = #{power(2,1)}"If I were an interviewer, I would ask the Aug 29, 2010 poster why he used bitwise operators, and whether he would deploy that code in a production environment, or if he merely wanted to demonstrate, for purposes of the interview, that he understands bitwise operations.Because it uses dynamic programming and is lots more efficient than your algorithm.If the power is not integer, use ln and Taylor seriesIf I'm the interviewer, none of above answers is acceptable. What if y < 0? what if y < 0 and x == 0? I'm seeing an endless recursion that will eventually overflow the stack, and the none-recursive one just simply returns 1.There is a way to do this in a logN way rather than N. function power(x, n) { if n == 1 return x; // Even numbers else if (n%2 == 0) return square( power (x, n/2)); // Odd numbers else return power(x, n-1); } This is from Programming pearls.. interesting way.small mistake function power(x, n) { if n == 1 return x; // Even numbers else if (n%2 == 0) return square( power (x, n/2)); // Odd numbers else return power(x, n-1) * x; }# Solution for x ^ n with negative values of n as well. def square(x): return x * x def power(x, n): if x in (0, 1): return x if n == 0: return 1 if n < 0: x = 1.0 / x n = abs(n) # Even number if n % 2 == 0: return square(power(x, n/2)) # Odd number else: return x * power(x, n - 1) print ("0 ^ 0 = " + str(power(0, 0))) print ("0 ^ 1 = " + str(power(0, 1))) print ("10 ^ 0 = " + str(power(10, 0))) print ("2 ^ 2 = " + str(power(2, 2))) print ("2 ^ 3 = " + str(power(2, 3))) print ("3 ^ 3 = " + str(power(3, 3))) print ("2 ^ 8 = " + str(power(2, 8))) print ("2 ^ -1 = " + str(power(2, -1))) print ("2 ^ -2 = " + str(power(2, -2))) print ("2 ^ -8 = " + str(power(2, -8)))

### Senior Software Engineer at Palantir Technologies was asked...

Aug 26, 2010
 Given and array. How do you find if there are such three numbers whose sum is Zero. What is the cost of this algorithm?5 AnswersIterate over array using two nested loops, calculate sum of any possible combination of two numbers and store result in the set. Cardinality of this set would be n^2. Then, iterate over the array once again and check if for element e, we have -e in the set. Cost of this algorithm is O(n^2).The solution suggested by the Interview Candidate is not suitable to solve this problem. Consider the array contains [-6 3], if you use that solution, you will end up in the last phase of the algorithm checking if a 3 exists in the array, which resolved to true. However there are no three numbers in the array that sum to zero; we just considered 3 two times. One solution is to keep track of the numbers used in each case, but that's an additional O(2n) space complexity. I propose a more efficient solution in O(n^2) time complexity and O(1) space complexity. Let's first sort the array in O(n log n) using quicksort; that's in place sort so no additional space requirements. At this point, all elements are sorted in ascending order. for (int i = 0; i j) { int sum = arr[i] + arr[j] + arr[k]; if (sum == 0) { return true; } else if (sum < 0) { // We need a larger number j++; } else { // We need a smaller number k--; } } return false; }Correction: the return false should be moved after the last brace.Show More Responsesshouldnt variable j be initialized to i+1? otherwise the first time sum is computed it uses arr[i] twice?make two hash tables loop through the array it once put all the numbers in the hash#1 gather all keys from hash#1 loop through the array again for each key in hash #1 add value from the element in the array that value, put it into hash#1, sad n^2 then another loop to check for the element * -1 if it exists in the hash, if true, u found a zero other solution: just sort it which is faster, n log n grab the min and the max generate all the permutations of 3 numbers that when added equals 0, in a set of min,max numbers (including duplicates, ahead of time) loop through the array and check if those 3 numbers exist then u did it in n log n! congrats! mine's the fastest

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

Jan 26, 2010
 How do we index data stored into 5 different databases3 AnswersSuggested to use Lucene/Solr.I'd ask you for more detail, just how would you use SOLR? Configuration, schema, etc. One word answers don't really do the trick (for me, anyway)The question is very vague. If you're trying to ask by what mechanism can you employ to index content from a relational db (i.e. MySQL, Oracle ) you could configure a DataImportHandler. See the following: https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler Otherwise, you'll have to ask for a bit more details.

Jan 21, 2011
 Implement strstr in C2 AnswersIs strstr the question asked?I was asked the same question. I was told that it was not the efficiency of the algorithm that I should care about but the cleanliness and readability of the code. I used a naive brute force approach for the problem and the interviewer was satisfied.

Aug 26, 2010

### Senior Software Engineer at Palantir Technologies was asked...

Aug 26, 2010
 Given two arrays with length M and N. How do you merge them. What is the cost of operation?1 AnswerSort these two arrays using quicksort. Then iterate for i =0; i

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

Feb 10, 2011
 Given elements in a linked list, provide the most efficient way to reverse them.1 AnswerThe idea is to not use any other data structures from the Collections API.

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

Feb 6, 2012
 Explain x86 calling convention1 Answer__cdecl: Caller: pushes params. on stack, pushes return PC. Callee: pushes current stack base pointer onto stack, sets SBP to current stack pointer, pushes/saves CPU registers (optionally), allocates local vars. on stack (optionally), does the work, release local vars (if allocated), restores CPU registers (if saved), restores SBP, jumps to return PC address, return value is in EAX register. Caller: pops off params. off of stack.

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

Sep 27, 2011
 algorithm for getting the number of anagrams.1 AnswerThis is simply the number of ways you can permute a string. Simply pass in a boolean array that determines which letter of the string have been used and which haven't: permuteStrings(String x, int currentIndex, boolean[] isUsed, char[] originalString) { if (currentIndex == originalString.length) { System.out.println(x); } else { for (int i = 0; i < originalString.length; i++) { if (isUsed[i]) { continue; } else { isUsed[i] = true; permuteStrings(new String(x.append(originalString[i])), currentIndex++, isUsed, originalString); isUsed[i] = false; } } } }

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

Jan 6, 2012
 What is your plan for the future?1 AnswerI have two plans mainly, one to expand the current work and got promoted, and the other one is to go look for better places than the one I have now.
110 of 96 Interview Questions