# Software Interview Questions in Boston, MA

Software interview questions shared by candidates

## Top Interview Questions

Lots of questions about arrays, lists and hashmaps 1 AnswerFocus more on how hashmap works and its applications |

### Java Software Engineer at Help Scout was asked...

Write a method to determine if a string starts with an uppercase letter. 1 Answerwouldn't it just be return string.charAt(0) == string.charAt(0).toLowerCase() |

### Software Engineer at Vistaprint was asked...

How many bottles of shampoo are produced in the world a year? 25 AnswersNot enough, apparently. Let's start with the US market: 300X10^6 people. About 60% use shampoo (others are bald or use soap). They go through about one bottle every two months, so that is about 1.8X10^9. Human population is about 6.6 X 10^9. As far as the undeveloped nations, most people don't use shampoo. The developed world is about four times the size of the US population or approximately 1.2 X 10^9. People in the US wash their hair more than in Europe, but I will neglect this. My estimate is about 5X10^9 bottles. Enough to wash everyone's hair. Show More Responses 15 * 10^9 Could you please provide more info. Does this include sample size & super size bottles? sssss ssss wwwww sssss wwwww wwww www kkjk kjskjsk ksksjksj ksksjkjsknksnk knsknkskns ,xmnkjkjxc Show More Responses yeah ok inwiill be more b=vernose butvwhatvthe fucj do youwnat me tinsay? nothing to sau actually what ou ghing to do? gbh bh bh ok i will say that you re shite aactulall as you want to know more nad more yeag ur vhvgi I would assume 6 billion people in the world- 50% use shampoo others just use regular soap. Assume that we are using some std sze bottle ~15oz. With daily use of 1/2 oz/day a bottle would be used in 1 month (probably close for US and western counties). However men use less than women and developing coutries would likely not shampoo daily. Generous estimate is a bottle lasting 1.5 months. Therefore each person uses 8 bottles /year. 8 x 3 billion is 24 billion bottles view my answer at http://bit.ly/b8riKs 1. Production is always>consumption because we have more product varieties to sell 2. We never see any shop with out of stock shampoo products, forget brands in this case. 3. Even if we consider 50 per population uses shampoo, they will never run out of shampoo because not everybody uses one bottle/person. A family might use one bottle. Enough to wash everyone's hair and keep bathrooms, store shelves, and warehouses stocked. A s a sales person, I'd be more concerned with how many bottles of shampoo can be moved from one place to another in a year as this is what generates revenue. Show More Responses All of them. Lets look again at the question- it is not 'how many bottles of shampoo are USED" the question clearly states "how many bottles of shampoo are PRODUCED in the world in a year". It interests me to note that this is a production question for a software engineer position which clearly leads me to determine that the answer is not meant to be a number but a program or mathmatical equation of some sort. There is not enough information listed to solve to any given number with so many variables, and it is not safe to assume that 50% of the population uses shampoo or how many people are bald. The idea is to take the information given and develop a method to calculate the numerical value if the actual values are supplied. |

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

write a program to translate alphanumeric phone number to numbers only 6 AnswersActual translation is easy. Store information is a hashmap (key,value) for example (abc, 2), (def,3) ...(wxyz, 9). You can get the information back very easily in O(1) time. Even when you have 20 characters in the alphanumeric string: 1(800)gofedex. It would still be very efficient O(20) etc...But extracting the information you need is somewhat complicated because you can't control what a user enters...lots of cases to consider...not in a 30 minute phone interview. Why wouldn't you map ..... ..? it reduces complexity of retrieval. You're saying you can't come up with a 10 line solution in 30 minutes but want a job at google? Once you came up with the crazy hashmap idea you had already failed the interview .... the solution to every problem is not a hashmap, especially when a simple lookup table will do. Show More Responses public class PhoneConverter { public static List convertPhone (List list){ int[] values = new int[26]; int i=2; int j=0; for (char tag='a'; tag temp = new LinkedList(); for (Character c : list){ if (Character.isDigit(c)){ temp.add(Integer.parseInt(c.toString())); } else{ temp.add(values[c-'a']); } } return temp; } public static void main(String[] args){ List input = new ArrayList(); input.add('1'); input.add('8'); input.add('0'); input.add('0'); input.add('g'); input.add('o'); input.add('s'); input.add('z'); List output = convertPhone(input); for (Integer num : output){ System.out.println(num); } } } Yeah, this is a very simple problem IMO. As she suggested, you can just consider alphanumerics so you don't really have to worry about the input. Also you can convert all characters to small caps or big caps to make things easy. Then use a simple array of size 26 to map a character to its corresponding number, go through the input number and replace each character with the value in the array. {{{ void convert_numeric(char a[]) { char *p = a; char *post = a; char map[27] = {0}; strcpy(map,"22233344455566677778889999"); while(*p != '\0') { if((*p >= 'a') && (*p = 'A') && (*p = '0') && (*p <= '9')) { *post = *p; post++; } p++; } *post = '\0'; } }}} |

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/11 Here, 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. |

sorting the red and green balls.RRRRRGGGGGGGG to RGRGRGRGRGGGGG 3 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. |

### Software Engineer at Next Jump was asked...

How would you center a div? 3 AnswersI said to use tags but they wanted a CSS answer, which I didn't know (I was really trying to get a job as a PHP dev with minimal UI). #divname{ width: 50%; margin: 0px auto; } <div> </div> |

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

Find the largest 100 numbers out of a list of a trillion unsorted numbers 4 AnswersUse a heap to hold the 100 largest numbers so far. If the new number is larger than the heap top (the smallest number in the heap) pop it out and add the new number. The worst case complexity is O(N * log(100)). Hence log(100) is a small constant (7) the complexity should be good enough. That's a great idea. Another approach could be using a select algorithm to select the N-100 biggest number in O(N) time and then partition around its value, again in O(N), to get the 100 biggest numbers (in unsorted order). Note that this is actually independent of how many of the largest numbers you need. Would it be crazy to just merge sort the numbers and then print the last 100? Show More Responses @Chris - yes, because mergesort is O(n logn) where n = 1 trillion; sorting is _highly_ inefficient in this case. |

### Software Engineer Intern at Intuit was asked...

How will you make this code readable (given a piece of code) 3 AnswersClass names were weird. 1. use meaningful conventions and variable names , in Classes , methods , interfaces , packages etc 2.putting comments wherever possible to make the code more readable 3. make code more modular , by dividing the code into functions and the main code Hey guys I used rooftop slushie to get Intuit interview information. You should give it a try! https://wwww.rooftopslushie.com |

What is the efficiency of finding an element in an unsorted array of strings 4 AnswersO(n) O(n/2), no? Complexity is O(n) but running time can be faster if run parallel. Show More Responses Yep the actual average time could be C * (N/2) but still the complexity in bigO format should be O(n). |

**1**–

**10**of

**1,554**Interview Questions

## See Interview Questions for Similar Jobs

- Medical Assistant
- Mechanical Engineer
- Accountant
- Sales Associate
- Social Worker
- Hospitality
- Account Executive
- Graphic Designer
- Truck Driver
- Engineering
- Cashier
- Pharmacy Technician