# New business development Interview Questions

# 7K

New Business Development interview questions shared by candidates### Write a function that finds the median of a set of three numbers, also find the Big O. Can it be done with only 2 comparisons, or do you need 3?

11 Answers↳

Actually the answer is the next one: we could have an answer using only two comparisons. The main idea is that we need to examine one of the numbers to get into the segment created by the other two numbers. And another important thing is that one comparison could be used to definitely determine for both two segments created by two numbers. For example we are trying to examine number A and we have two segments formed by B and C numbers: [B; C] and [C; B]. But considering that for determining if A is in the segment created by B an C we need to make the following comparison: (A - B) * (C - A) >= 0. It is easy to notice that if A is in segment [B; C] (B is less or equals to C) we have both multipliers are positive but in an opposite case when A is in segment [C; B] (C is less or equals to B) we have both that multipliers are negative. If former comparison is negative - then number A is not in any of segments [B; C] or [C; B]. And here is a code of function on C/C++: int medianOfThreeNums(int A, int B, int C){ if ((A - B) * (C - A) >= 0) { return A; } else if ((B - A) * (C - B) >= 0) { return B; } else { return C; } } Less

↳

void GetMedian(int a, int b, int c) { int small, large; if (a < b) { small = a; large = b;} else {small = b; large = a;} // Check where c lies: if (large < c) return large; else if (c < small) return small; else return c; } Less

↳

I'm not following. Is this: say, B+C is less than A+C, then the larger of B and C is the median? If so, isn't this a counterexample: A = 2, B = 1, C = 3? Less

### Implement division without using multiplication or division. It should work most efficient and fast.

11 Answers↳

exp(ln(a)-ln(b))=a/b

↳

What if one or both of a,b is less than zero. ln(x) for x < 0 is not defined. Less

↳

Obviously the interviewer would not allow us to use Math functions like exp, log etc. We are supposed to use the Long division method or the Newton Raphson method to find the quotient. Newton Raphson is the fastest but uses operator * (multiplication) though. Less

### Design patterns questions

10 Answers↳

It was on 03-14.Within 2 days they scheduled for onsite interview.By the way what all design pattern questions they asked you in first round?I was asked only Observer Pattern and Singleton Pattern Less

↳

Ya the same thing.....I already listed right...I had a difficulty in answering Observer pattern so listed here so that others can prepare well :) On site they will ask to write small code I guess but not so complicated. I heard that fidelity interview is not that tough as tech companies. So prepare well, answer confidently. All the best for the interview. Less

↳

Did you guys gave the on-site interview? How was the experience?

### Improve this piece of code, loop tracing, very basic printing problem

10 Answers↳

Did they ask salary expectations? Do you think you might have been rejected because you asked for too much $? And you say you answered everything correctly you think? Less

↳

We didn't even get to salary expectations actually. Yea I'm very confident I answered everything correctly. It was definitely not a difficult assessment at all. I know it's kinda tough but try not to be discouraged, unfortunately it's not uncommon for you to ace a technical but still get rejected. All we did was have the technical thing on a google doc, then afterwards they explained what the company does, which is build custom software essentially, and then asked if I had questions. Hopefully you guys have better luck than I did. Less

↳

I have an interview with them this upcoming next week, I am sorry it did not work out I am sure you did great. Makes me a bit nervous you aced it and didnt get a call back. Less

### Given a base 10 number, print the hexidecimal (base 16) representation of that number.

7 Answers↳

lol, I wonder if this is acceptable printf ("%x",n); //n being the base 10 number Less

↳

String buffer = new StringBuffer(); while (n > 0) { int base = n% 16; buffer.append((base<10 ? base : (Char)('a'+base-10)); n /= 16; } String result = buffer.toString().reverse(); Less

↳

public String toHex(int num) { if(num == 0) return "0"; char[] map = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; String result = ""; while(num != 0){ System.out.println((num & 15)+ " "+ result); result = map[(num & 15)] + result; num = (num >>> 4); } return result.toString(); } Less

### We have a fairly large log file, about 5GB. Each line of the log file contains an url which a user has visited on our site. We want to figure out what's the most popular 100 urls visited by our users.

6 Answers↳

cat log | sort | uniq -c | sort -k2n | head 100

↳

I would add a min-heap of size 100 to BetterSolution's answer (in order to get the top 100). Less

↳

Quick Sort is O ( n log n ) avg case, so we could do better O (n) Now, onto design : Do the lines have other information other than URL? If so, we need to filter them out using Regular Expressions. Possible O (n) solution: A hashmap with URL's as keys and number of hits as values would yield a O(n) run-time to populate it. Algo: while input from file getURL (or filter out URLs from line) if URL exists in hashmap, increment its count else add URL to hashmap Ofcourse, being a large data set, we might get a ton of random disk seeks due to paging of memory. After profiling, if we really find that to be a problem then we could do something like encode the urls into something smaller that takes less space and hence has a lesser probability of causing paging. I can think of few more solutions but I think this should be sufficient. Less

### Tell me about the 3 biggest weaknesses you have?

5 Answers↳

I assume the leadership role when it's not designated to me because I am interest in taking on responsibility. Less

↳

The "What is your biggest weakness?" question is a stock question in the interview processes. Generally speaking, when noting a weakness it should be a small, nominal item and relevant to the workplace. Certainly, be honest, as it could come back to you later in your career. For example, if you note being too talkative as your weakness, but hardly say a word once you have landed the job or during the interview, it could impact your credibility. Most importantly, when you're provided the opportunity to answer this question, be confident and try to make a professional, memorable impression to set yourself apart from the other candidates, because that's really what it's all about. Less

↳

I tend to explain to much beyond what is needed/required.

### WHAT IS YOUR AGE??? - A totally prohibited ground in HR context.

5 Answers↳

Look at the question: "What is your age?" That's different from "How old are you?" Answer accordingly. Less

↳

I was asked this question by the CEO of a company during my telephonic interview. Even though I didn't ask, told me his age. That just seemed weird and not very professional. This wasn't Deloitte. Less

↳

So many ways to find this information - in a, sort of, sneaky way. Has no-one noticed that now you not only being asked for your degrees but what year you obtained them - easy enough to extrapolate in the majority of cases... Less

### How to access data from a tree structure and to sort them into an array?

5 Answers↳

Is it just a plain rooted tree or is there any property associated with the tree. Less

↳

I'm not a CS student, so I'm not sure if it is a plain tree. It is a rooted tree, and each branch with one or two branches below. The solution seems using recursion. Less

↳

Generally in this type of question, tree should mean a binary search tree in which each left child (and subtree) is smaller than the parent and right child (and subtree) is greater than the parent. So it requires an inorder traversal of this tree to obtain values in a sorted order that can be put in an array. Less

### Phone interview questions: Given an array of numbers (1,2,3,8,0,2,2,0,10), move all 0s to the right end and all other numbers to the left while keeping relative order of non-zero numbers. Has to be linear in time and in-place.

5 Answers↳

Similar to quickSelect algo.

↳

Same idea that in-place partition for quicksort, swap them if the number is 0, at the end you will have all the 0's in the right side Less

↳

array = [1,2,3,4,0,5,6,0,7,8] for (i = 0, z = 0, l = array.length; i < l; i++) { if (i < l - z) { if (array[i] === 0) z++ else array[i - z] = array[i] } else { array[i] = 0 } } Less