Software Developer Interview Questions in Boston, MA | Glassdoor

# Software Developer Interview Questions in Boston, MA

"Software developers design, write, test, and maintain the code for a software system. Extensive knowledge of programming languages, data structures, and algorithms are necessary to pass the technical interview which is designed to test these skills. Employers are looking for candidates with a bachelor's degree in computer science or related field or equivalent work experience. "

## Top Interview Questions

Sort: RelevancePopular Date

### Software Engineer/Java Developer at BzzAgent was asked...

Dec 17, 2012
 Lots of questions about arrays, lists and hashmaps1 AnswerFocus more on how hashmap works and its applications

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

Jan 29, 2012
 Given a binary tree with the usual left and right pointers on each node, and additionally a parent pointer, make an algorithm to discover the closest ancestor to 2 nodes on the tree.7 AnswersTime complexity is : O(max height of binary tree) public void findCommonAncestor(Node current,int a,int b){ if(current.getKey() a && current.getKey()>b){ findCommonAncestor(current.getLeft(), a, b); }else{ System.out.println(" least common ancestor is "+current.getKey()); } }analog76, your solution is not complete.@clusterfudge, what do you mean by incomplete? Can you be more precise?. Common ancestor - first encounter of node value between a and b. Otherwise either you go left or right node.Show More ResponsesAs far as I concern it is a binary tree not binary SEARCH tree.thanks @naipton. 1) Find matching node for the first value in the tree. If the node found create a set contains all its parents till the root. 2) Use postorder traversal for recording all the ancestor. 3) P1 is parent, P2 is grand parent and P3 is ggparent and continue till root. V1={P1,P2,P3,P4,....root} 4) Similary find all the parent of second value V2={P1,P2,P3,.root}. 5) traverse both set and first matching element in both sets is lowest common ancestor.Find height of node 1 as h1 and height of node 2 as h2 by travelling to the root. Time O(2 lg N). If h1 > h2, then move node1 by h1 - h2 and vice versa. THen, use two pointers to move one parent at a time until parent nodes are same. Complexity - O( 3 lg N)Assuming each node has a unique ID (its memory address, for example), you can solve this in O( 2 lg N ) where N is the number of nodes in the tree. findCommonAncestor(Node x, Node y): 1. Initialize a hashmap, call it `parentsMap`. 2. Starting from x, visit all its parents up to and including the tree root, and for each parent `p`, set parentsMap[p.id] = true 3. Starting from y, begin to visit its parents and for each parent `p`, check parentsMap[p.id]. If true, return p.id. Else, continue visiting parents until `p` is null, at which point we return null.

Oct 5, 2012
 count the number of duplicates in a binary tree in O(n) time O(1) space.5 AnswersIn order traversal passing down the parent key value to the right child and the previously passed value to the left child, checking for duplicates and adding one to the returned value as you go along.there is no such info left-right-parent comparision info in a *BT*. I think you are talking about *BST*...yes you are correct, I meant a BSTShow More Responsesdo you remember questions asked OnsiteHey guys I used rooftop slushie to get an answer for this interview at TripAdvisor. You should give it a try. https://wwww.rooftopslushie.com

Jan 29, 2012

### Software Development Engineer (Computer Vision) at Amazon was asked...

Nov 22, 2012
 How would you code up a custom rectangle detector?5 AnswersI suggested something about matching intersecting hough lines.Hi... Could you plz explain what is a custom rectangle detector...I hav my interview with Amazon on monday ... plz helpBy a custom rectangle detector I mean how would you write your own function to detect rectangles. Your input would be the pixel data and your outputs would be something like the x,y locations of the rectangles.Show More ResponsesFirst of all, hough transformation can be used. just parametrize the representation for rectangle, but the parameter space is 4D. Second, line detection, followed by checking corner degree. In practice, I would use opencv's coutour fitting function to fit for quadrilateral, then check the angle. This works quite well.I would scan the image with a basic edge detection mask. Then I would scan to count the number of lines, keeping track of end points in pairs. Cases such as curves would also be found in this step and returned as not a rectangle. An analysis of basic trig with the points could then be performed in order to determine if the points form a rectangle. Once a rectangle is confirmed then you could use those points to display on the image the recognized rectangle. Or do whatever the reason for finding the rectangle was.

### Software Development Engineer at Microsoft was asked...

Aug 13, 2013
 Given a sentence input : helloworld output: HelloWorld YOu should make use of a dictionary available with you. Capitalize the dictionary words in the sentence4 Answerspublic String capitalizeFirstChar(String str) { String s = " "; String[] newString = str.split(" "); for(int i = 0; i < newString.length; i++) { String ssttrr = newString[i]; String firstChar = ssttrr.substring(0, 1).toUpperCase(); s = s + firstChar + ssttrr.substring(1)+" "; } return s; } Test: Input: hello afful how are you doing today? Output: Hello Afful How Are You Doing Today? I welcome any improvements..if any. Let keep learningwhere are you using Dictionary?I don't think Afful is right, the question doesn't include the space at all, so you cannot assume there are spaces and use the split function. Since you have the dictionary, I think the point is to find the head node in the dictionary and capitalize it.Show More Responseshttps://leetcode.com/problems/word-break/description/

### Financial Software Developer at Bloomberg L.P. was asked...

Mar 25, 2011
 6 face dice. He rolls 1 to win, and me 6. He rolls first, what's the probability that he eventually win.3 AnswersI didn't answer the exactly number...but it's fine.1/6 + (5/6)^2 * (1/6) + (5/6)^4 * (1/6) +.... = 6/11Here, there are infinite possibilities. He might win in his first attempt, or second attempt, or third attempt or so on... So the probability goes like this: (1/6) + (1/6)^2 (5/6) + (1/6)^3 (5/6)^2.... If you read the pattern....it is in geometric series with initial value as (1/6) and the ratio of (1/6).(5/6)...And we can solve this question further by applying geometric series.

### Financial Software Developer at Bloomberg L.P. was asked...

Mar 25, 2011
 sorting the red and green balls.RRRRRGGGGGGGG to RGRGRGRGRGGGGG3 AnswersThis will be a simple, intuitive way. It doesn't guarantee any efficiency. Count the number of R's in RRRRRGGGGGGGG. Then, we will also have the number of G's by subtracting the number of R's from the total size. Now you we compare two values, here R is less than G. So we create a new array with initial total size with everything initialized as lets say A. Replace A with R on alternate slot. Then replace the rest with G. The time complexity for this will be O(n)Or you can keep track of count and work accordingly.If we know the number of reds, then we can swap with green ball starting from index 1 till red balls finish by skipping 2.

### Financial Software Developer at Bloomberg L.P. was asked...

Mar 25, 2011
 1 step: 1m /2m. How many ways you can walk through a 10 meters road.3 Answersassuming x=no. of 2 steps and y=no. of 1 steps, then 2*x+y=10, where x<=9 and y<=10. Solutions are (x,y)=(0,10),(1,8),(2,6),(3,4),(4,2),(5,0). So there are 6 ways. Assumption: Order in which 1/2 steps are taken is not considered (although that can be easily included into the problem)I didn't quite well get the question. However I understood the solution part though.1 1 2 3 5 8 13 21 34 55 89 Ans= 89