# 2K

Lead Software Developer interview questions shared by candidates

## Top Interview Questions

Sort: Relevance|Popular|Date

### Coding test: 1. Given a string, find out if there's repeat characters in it. 2. SQL. Given a Customer table and a Payment table (with Customer ID as primary and foreign key), write a query to output a list of customers who have not paid their bills in the last 3 months.

Did well on the first Java coding test. Solution using Hashset. Not so well on the SQL query. Able to give a query, but a few errors in it I am sure. Also there was a second questions regarding the SQL query, which we didn't have time to get to. So that was another bad thing. I am pretty sure I did not pass. But good learning experience. Less

import java.util.*; public class test { public static void main(String[] args) { String str = "abdc"; char[] arr = str.toCharArray(); HashSet set = new HashSet(); for (char i : arr ) { set.add(i); } if((set.size()) == (arr.length)) System.out.println("unique character"); else System.out.println("repetition"); } } Less

No

### Given an array of numbers, e.g. [5,0,9,2,5,5,5] - return all the consecutive numbers that add up to N.

There were two followup questions to this. a) What if there are lot of zeros after the sum is 10. E.g. 505000000 - what would it return? b) what if we allow negative numbers. For example 5,5,-6,6,0,0 We also discussed its time complexity. Less

The following should work. cheers! public int[] calculateSumSet(int[] inputArray, int desiredSum) { for (int stratingIndex = 0; stratingIndex &lt; inputArray.length; stratingIndex++) { int sumOfSubArray = -1; int endingIndex = stratingIndex; do { sumOfSubArray = getSum(inputArray, stratingIndex, endingIndex); if (desiredSum == sumOfSubArray) { return subArray(inputArray, stratingIndex, endingIndex); } endingIndex++; } while (endingIndex &lt; inputArray.length);//&amp;&amp; sumOfSubArray &lt; desiredSum } return null; } private int getSum(int[] inputArray, int stratingIndex, int endingIndex) { int retValue = 0; for (int i = stratingIndex; i &lt;= endingIndex; i++) { retValue += inputArray[i]; } return retValue; } private int[] subArray(int[] inputArray, int stratingIndex, int endingIndex) { int[] retValue = new int[endingIndex - stratingIndex + 1]; int j = 0; for (int i = stratingIndex; i &lt;= endingIndex; i++) { retValue[j] = inputArray[i]; j++; } return retValue; } Less

Hi, What made you say that "Talking about TDD in a company where tests virtually do not exist is a big no-no"? Did you talk about it in general or did you make your presentation on/about TDD? What do you recommend for future candidates? --prospective candidate Less

### Input is a string like "AAAAABBCCAA" and it should print "5A2B2C2A". 5 being the continuous number of occurance for character 'A'. Same is with other characters also.

let string:String = "AAAAABBBVVVCVCAA" let characters = Array(string) var counter:Int = 1 var newArray:[String] = [String]() let lastCount = characters.count - 1 for count in 0...(characters.count - 2) { if characters[count] == characters[count + 1] { counter = counter + 1; }else { newArray.append("\(counter)\(characters[count])") counter = 1 } if lastCount == count + 1 { newArray.append("\(counter)\(characters[count])") } } print(newArray) Less

public static void main(String[] args) { String s = "AAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBCC"; Set set = new HashSet(); char b = 0; int count = 1; String newString = ""; for (int i = 0; i 0) { b = s.charAt(i - 1); } char c = s.charAt(i); if (!set.add(c)) { count++; } else { if (b != 0) { newString = newString + b + count; count = 1; } } } newString = newString + b + count; System.out.println(newString); } Less

public static void main(String[] args) { String s = "AAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBCC"; Set set = new HashSet(); char b = 0; int count = 1; String newString = ""; for (int i = 0; i 0) { b = s.charAt(i - 1); } char c = s.charAt(i); if (!set.add(c)) { count++; } else { if (b != 0) { newString = newString + b + count; count = 1; } } } newString = newString + b + count; System.out.println(newString); } Less

### 2. Swap the two values (int A=5 and int B=3), w/o using a 3rd attribute(so you cant use the 3rd attribute to store the value as a temporary storage).

Both previous answers are theoretically correct, yet buggy. 'A' could potentially overflow due to (A+B) or (A*B). Therefore, the best method is to use the 'xor' operator. A ^= B; B ^= A; A ^= B; Less

first you do A= A*B, next you divide B=A/B and finally A= A/B.

A = A+B B = A-B A = A-B

### How would you do something similar in java that javascript provides for passing functions as arguments

callbacks come close, but don't provide similar functionality

is command pattern a close hit?

### So how do you implement workflow?

Me: So to implement workflow, you need to actually map out the "work flow" ... NO. NO. NO. How do you implement it? Me: Well, you do realize that you have to map out the workflow, right? Have you used the WorkFlow Designer? It leverages Microsoft Visio to map out the "work flow" as a diagram.... Yes, I know that but how do you make it work? Me: Well, once you map the "work flow" then you save it and you have to code C# fragments that you attach to each node in the diagram that performs a specific action. So the actual diagram is key to the workflow implementation, because the rest is just C# fragments.... Ok. ok. ok. Next question. It turns out that he is a Java guy, like 75% of Silicon Valley and as soon as you say C# they "tune out" and do not want to hear more. Less

The point was to highlight the lack of diversity and how unwelcome I felt after being asked to come in for an interview, but if you must know. I include India when I say asian, but maybe some prefer differentiating asian, south asian, etc. Just gets silly. Anyway, interviewer #1 was probably Chinese female from the name. Interviewer #2 was Indian male. Interviewer #2 was definitely Chinese male. As for the people I saw in the cubicles, they were all Indian males from the people I saw conferencing together in cubicles, and the other 2 people interviewing were Indian females. Explicit enough detail for you? I really enjoy walking around the Google campus. VMware is also another GREAT campus. So much diversity in terms of age, race, etc although I know those campuses have a TON of students interning and working temporarily there, so they might not be permanent staff. Less

Are you including Indians as Asian? Were there a lot of Indians? Or mix?

### Given a set of components like A,B,C,D... And their ordered dependencies like A -&gt; B,C B -&gt; C C -&gt; D find the dependencies for any given component "X".

The question involved setting up a data structure and algorithm to solve this. I used list of lists and made a recursive solution. Less

By assuming there will be no circular dependencies, one can setup a 2d matrix of dependencies then perform a dfs/bfs starting from the input X node and flag all the dependent components. Less

I can think of 2 approaches 1. Make lists and recurse till u reach X; return the success/fail status and add to a list of dependencies iff the status was a success 2. Make a directed graph out of this (Iff there are no circular dependencies). Then perhaps do a topological sort (use DFS/BFS). All the vertices visited before X are dependencies (2 data structures used here: Graph and Stack) Another possible solution: Make a directed graph, reverse all edges so that all incoming edges are outgoing. Then do a DFS/BFS to figure out which parts of the graph are accessible from X Less

### Given a paragraph of English words, write a function returning the least used word in the paragraph.

use split function in the paragraph to split each line into an array by splitting with space. Write a hashmap function, then compare the counts of all the hashmap, who so ever count is least return the key of that count value. Hence we have the least word in the paragraph used Less

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Ticketmaster or ex-Ticketmaster Lead Software Engineer experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews Less

### "Do you have any Anxiety disorders or other Mental Health issues?"

It's very sad to me that VPs run the show there. Everyone is under experienced and it shows in their interview decorum. I believe they will be in legal trouble sooner than later. Less

This is the first time I have ever witnessed this happen in an interview and I didn't quite know how to respond. It was even more shocking to have such a blatant violation of the ADA coming from someone with a VP proceeding their name. I would suggest that anyone receiving such questions during any interview, calmly excuse themselfs from the interview to pursue a conversation with HR immediately. Additionally, you may wish to consider retaining a Lawyer. Less