# Interview questions in New York, NY

Bloomberg L.P. Interviews in New York

www.bloomberg.com / HQ: New York, NY

1,192 Interviews in New York (of 4,859)

J.P. Morgan Interviews in New York

www.jpmorgan.com / HQ: New York, NY

998 Interviews in New York (of 6,499)

Goldman Sachs Interviews in New York

www.goldmansachs.com / HQ: New York, NY

976 Interviews in New York (of 4,542)

## Interview Questions in New York

An array of 99 elements contains integers from 1 to 100 with one missing element. Find the missing element. 22 Answers100 1. calculate the sum of elements in array say SUM 2. sum of numbers 1 to 100 is(n* (n+1))/2 = 5050 when n==100 3. missing element is (5050-SUM) 100 Show More Responses The parameters of the question do not allow you to determine what element is missing. Either more information should be supplied, or all answers are equally correct. How could an array size of 99 elements contain 1 - 100? Should either be integers 1-99 or 2-100 , in either case there is no missing element. All indices are accounted for. Sum them and then subtract them from 5050. In general, if an array of size n - 1 elements has unique elements from 1 to n, then the missing element can be found by subtracting the sum of the elements in the array from sum(1 ... n) = n * (n + 1) / 2. Alternately, one could use a boolean array of length n with all values set to false and then for each value, set array[val - 1] to true. To find the missing value, scan through the array and find the index which is set to false. Return index + 1. This requires O(n) memory and two passes over an O(n) array (instead of constant memory and one pass), but has the advantage of actually allowing you to verify whether or not the input was well formed. Admittedly, this question is poorly posed; however, the answer they are looking for refers to the syntax/nomenclature of some (not all) programming languages to index arrays starting at “0.” As such the 1-100 stored values would be in entries 0-99 of the array. Read the question. Here are the steps to solve it: 1) find the sum of integers 1 to 100 2) subtract the sum of the 99 members of your set 3) the result is your missing element! Very satisfying! Sort array. While loop with an index variable with condition of next element being 1 greater than previous element. When loop breaks, return the value of the index. Doing the expected sum and subtracting the actual gives the run time of O(2n), however a bucket sort will almost always do it in less time (somewhere between O(n) and O(2n)): 1. create a 101-int (or boolean) array (to have a 100-index) 2. traverse original and for each int, assign value in bucket array to 1 or true. 3.After first traversal, traverse created array starting at one, and when value is false, print it. 100 100 coz in array it initial value starts frm 0 to 100. or else 4 further clarification u can study array chapter in c or c++ 100 Show More Responses The question: "An array of 99 elements contains integers from 1 to 100 with one missing element. Find the missing element." The information states that the integer count is 1 to 100. I take this to be inclusive of all elements in the array so that the missing inters would be subjective to their arrangement or random. In other words, I do not have enough information to say which one. 1 I need more information. 1. Are the integers unique in this array? 2. Do I have enough information to find the sum of the integers in the array (or some aggregation)? If sum is available, then, the answer is 5050-sum{integers}. Bucket Sort works and summation works. I think both are good, practical and clever solutions. I think sorting the array then searching may be unnecessary computation. Another interesting method which may be faster. SIMD computers may do this particularly quickly: Do a bitwise operation on all the elements: Result = Array[0] xor Array[1] xor ... Array[98] xor 1 xor 2 xor ... xor 100 Result = Missing number. Explanation: When you xor 2 identical numbers your result = 0. For example, 5 xor 5 -> 101 xor 101 = 000. (5 in decimal is 101 in binary). Knowing that "xoring" 2 identical numbers results in zero is useful. Now we apply this useful info to the problem. Array is Identical to a list of 1,2,3,...,100 except for one number. In other words 1,2,3,...,100 duplicates all of array's elements and adds one extra element that is missing in Array. Therefore, we now have 2 instances of each element in the Array in addition to one extra element in 1,2,3,...,100. We can see when you xor two duplicate numbers you get zero. Because we have pairs for all numbers in Array and one extra number we are essentially "xoring" the missing number with zero. When we xor the missing number with zero we get the missing number. (For example, 6 xor 0 -> 110 xor 000 = 110) The question states that one (not two or three or n) element ("value") from 1 to 100 is missing. There are 99 elements ("values") in the array. The question implies that the data is well-formed because it states that only element is missing. It doesn't ask you to find the missing value(s), but the one (singular) missing element. With the problem constrained, the solution falls out. Subtracting from 5050 is an elegant solution, but not obvious as to why it works. The array of booleans is more obvious, but doesn't scale well. I agree with one of the answers in this thread...5050-sum(elements) = missing item. Other approach that crossed my mind is something similar to binary search. Check the index of 50th element: if A(50) == 50, the missing element > 50, else if A(50) > 50, missing element <50. Do this iteratively. The number of comparisons would be log 100 = 7. 0 100 Add 1-100 to a hash of 100 elements. Then compare each element with the hash.. Answer in o(n) |

### IT Developer at FDM Group was asked...

How many unique handshakes if each person in a group of 10 give handshakes out to each and every other individual. (a) 100 (b) 50 (c) 45 (d) 20 (e) 10 3 Answers45. Imagine it as a polygon of side 10. Or draw out triangle, square, pentagon, and see the pattern yourself, if you don't know the algorithm. true, or 9+8+7+...+2+1 Or just do: (10 Combination 2) = 10!/(2!8!) = 45 |

What is a JavaScript callback function? 5 Answers5 vote down star 4 I understand passing in a function to another function as a callback and having it execute, but I'm not understanding the best implementation to do that. I'm looking for a very basic example, like this: var myCallBackExample = { myFirstFunction : function( param1, param2, callback ) { // Do something with param1 and param2. if ( arguments.length == 3 ) { // Execute callback function. // What is the "best" way to do this? } }, mySecondFunction : function() { myFirstFunction( false, true, function() { // When this anonymous function is called, execute it. }); } }; In myFirstFunction, if I do return new callback(), then it works and executes the anonymous function, but that doesn't seem like the correct approach to me. I don't think Bloomberg is a very good company. I am an excellent web developer and have gotten multiple offers from other companies with big names, but was rejected by Bloomberg. They are too demanding during the job interview and it becomes a game of how well you can interview as opposed to how talented an employee you are and how much you can contribute to the growth of the company. A callback function is a piece of JavaScript code that executes after the main function that the callback is attached to executes successfully. Show More Responses udaykanth, I would say that a .forEach() would be the most common and most basic use of a callback function. I'm just writing this to help anyone that might have a hard time thinking up a quick example if the come across this question themselves. Example: var numArray = [ 1, 2, 3 ] ; numArray.forEach( function( i ) { console.log( arr[ i - 1 ] ) } ) ; // logs out // 1 // 2 // 3 Is there a front end role at bloomberg. I guess your position must have been labelled software dev right? altho ur a dront end dev |

### Quantitative Analyst at Morgan Stanley was asked...

What's the best unbiased estimator for a series random variables? 3 AnswersI guess it is just a Gaussian distribution (Normal dist.). Since it has the smallest uncertainty (from quantum point of view) or variance. I guess it is just a Gaussian distribution (Normal dist.), since it has the smallest uncertainty (from quantum point of view) or variance. It is the OLS estimator (with Gauss-Markov approximations and normality), by Fisher's theorem on Maximum Likelihood Estimators. |

### Senior Java Developer at Contextweb was asked...

How would you scale access to a system like Twitter 2 AnswersThere's probably no real correct answer, though the solutions go from common to esoteric in a pretty normal progression: caching, shared-cache like memcache, optimize usage, prefetch, then get creative. This is more about testing reasoning and how far you'll go to solve a problem. I was thinking geographically distributed servers. |

### Systems Engineer at Avanade was asked...

What is the difference between RAID 0 & RAID 5? 2 AnswersIt should a simple question if you have worked with computers & HDDs. RAID 0 - Block striping (req. 2 HDDs) and no mirroring or parity RAID 5 - Block striping with 1 dedicated parity drive (req. 3 HDDs) To expand on the previous answer, RAID 0 improves HDD performance dramaticaly, but since there is no mirroring if one drive dies data is lost. RAID 0 should never be used on a system with critical data. In RAID 5, performance is slower, but it allows for the failure of a HDD with no loss of data. Consider instead, RAID 10. It requires a minimum of four HDD's, but provides an increase in performance with redundancy. |

How do you handle irate clients that are having technical trobules and need to work immediately. 3 AnswersRefrain from using technical jargon when explaining technical problems and solutions to clients and speak confidently. Approach the situation with 'we' working on the issue. Know that your are there to help solve this and act towards that, being calm and accurate towards solution. Even if the solution is that you will have to find out more and have to return to solve this issue. Ask for the ip address, then ask if it is an on or near-air emergency. Ask for the symptoms and if others are experiencing the same problem. If no one else is then have them jump on another pc if possible/feasible. Remote into the pc or tx the ip to the relevant trouble-shooter. |

### IT Associate at Morgan Stanley was asked...

25 horses in a race. 5 horses can run as a group. what's the minimum # of runs required to find the fastest horse. 2 AnswersI think 5. Split the horses into 5 groups of 5 then compare the time of the winners of each group. If time comparison is not allowed, then I'd say 6 races i.e. get all the winners to run one last race. Here is a different version of the problem but the answer is here - http://www.programmerinterview.com/index.php/puzzles/25-horses-3-fastest-5-races-puzzle/ |

Discuss what advantages and disadvantages there are to Web 2.0 1 AnswerSocial networking can be an advantage to a company; however it is also a time bomb waiting to go off. |

### District Manager at FGX International was asked...

Are you able to multi task, and how are you in handling irrate clients? 2 AnswersI enjoy being given additional responsibilities. As for irrate clients, all they want is for someone resolve the issue and for someone to take ownership of situation. Absolutely. With 22+ years with the same company and a demand to provide their needs based on strict lead times, clients are typically irate when communication lacked through the process. Transparency is key in addition to building a relationship through the process. |