Software Development Engineer Interview Questions in San Jose, CA | Glassdoor

Software Development Engineer Interview Questions in San Jose, CA

266

Software development engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Nov 12, 2009

Software Development Engineer at Microsoft was asked...

Jul 13, 2012
 Create a data structure that minimizes time complexity of retrieving median and inserting new element. Getting median should be O(1) and insertion should be O(log(n)).5 AnswersA heap in which the root is the median and it has max heap of the lower half on left and min heap of the rest on right.Can we not use a BST which is kept balance after every insertion using AVL ? The median is always the root of this tree, so median is retrieved in O(1) and insertion/deletion is O(log n) for balanced tree.I guess a Red-Black tree would be a more appropriate data structure to use. Since it is a perfectly balanced tree data structure, the median would always be at the root. The insertion takes time proportional to the height of the tree i.e. O(logn)Show More ResponsesWe can use two heaps, one max heap, one min heap. Large values are pushed into the min heap, and small values are pushed into the max heap. Keep the difference of the number of elements in the two heaps smaller than 2. The median will be the top of the heap with more elements or the average of the tops of the two heaps if they have same number of elements. I think this is easier to implement.array?binary search when do insertion?

Software Development Engineer at Facebook was asked...

Jul 13, 2010
 First question: for a random-ordered bucket of numbers 1 through 3000 with one number missing, how would you detect which number is missing?4 Answersbubble sort it and stop at the first number that >1 than the previous number already sorted number. you found the gap !Compute the sum of 1 to 3000, call this number N. Then compute the sum of the bucket of numbers, call this number S. The missing number is now equal to N - S.Get the sum of the list. N = 3000 S = (1 + N)*(N/2) Do a sort on the bucket with a value B Missing Number = S - BShow More Responsesxor all elements in the bucket -> A. now xor 1-3000 -> B. A xor B -> C. C is your answer

Software Development Engineer at Google was asked...

Jun 24, 2010
 Find the optimal map route between two points on a grid (maze) with some areas blocked out.3 AnswersIs this just testing if you know Djikstra's algorithm?Sounds more like an A* application to meBFS

Mar 30, 2010

Software Development Engineer at Google was asked...

Jun 15, 2012
 Browsers running javascript is single threaded, how can we make AJAX calls in the backgroung? 2 AnswersWe can use Javascript to make AJAX call in the background. Ex:For Chating ,we need to update the content of chat after every one or three sec so we call the javascript function once and then we use javascript inbuild function Settimeout() which call ajax in the background.JavaScript is single threaded, but AJAX is *asynchronous* (by default), so it runs in a background. If we need another thread, we can use web workers.

Software Development Engineer at Amazon was asked...

Apr 11, 2012
 Determine if two strings are anagrams. 2 Answerspublic static boolean isAnagram(String s1, String s2) { boolean result = false; //Basic check for the length if(s1.length()!=s2.length()) return result; char c1[]= s1.toLowerCase().toCharArray(); char c2[]= s2.toLowerCase().toCharArray(); HashMap h = new HashMap(); //Put chars from c1 in hashmap one by one. First with value as 1; then if the same letter is present as key then increment the value for (int counter = 0; counterif sort(s1) == sort(s2) then its an anagram

Software Development Engineer at Google was asked...

Oct 14, 2009
 What's your favorite programming language? Talk to me about it.2 AnswersThis was the most difficult because it was entirely open ended and required me to know a lot about the language, what it allows, how it differs from other languages, and how it might be implemented.I'd say Java, because it keeps me awake. Or maybe I'd say it's the next one I'm going to learn.

Software Development Engineer In Test (SDET) at Microsoft was asked...

Feb 11, 2012
 How can you write a recursive function calculating the exponential of a number?2 Answersf(n) = a if n=0. f(n) = a*f(n-1) otherwise.//Imports using System; //Test class class Test { //Constructor public Test() { //Nothing } public int RecursiveExp(int x, int n) { //First base case if (n == 0) { return 1; } //Second base case if (n == 1) { return x; } //Even values of (n) if (n % 2 == 0) { int y = RecursiveExp(x, n / 2); return y * y; } //Odd values of (n) else { int y = RecursiveExp(x, n - 1); return x * y; } } } //Main class class Program { //Main static void Main(string[] args) { //Create a test object Test tst = new Test(); //Examples Console.Out.WriteLine(tst.RecursiveExp(2, 0)); Console.Out.WriteLine(tst.RecursiveExp(2, 1)); Console.Out.WriteLine(tst.RecursiveExp(2, 3)); Console.Out.WriteLine(tst.RecursiveExp(2, 4)); } }

Software Development Engineer at Arista Networks was asked...

Sep 18, 2012
 linked list coding, compile and run. Also unix tools usage questions. 1 Answercoded online and got it correct.
110 of 266 Interview Questions