# Financial intern Interview Questions

# 879

Financial Intern interview questions shared by candidates### There are 20 floors in a building. If you're on an elevator and you're trying to get to the 20th floor, what is the probability that 4 people ahead of you click the 20th floor before you do? Assuming you click last.

9 Answers↳

The above two are close, but wrong.. There are 20 buttons, thus 20 choices, sure. But you are getting on at one of the floor. No body will press the button for the floor they get on.. Thus, there is really only 19 choices. P = (1/19)^3 (Independent events mean (1/19)(1/19)(1/19)). Less

↳

1/19 + 1/18 + 1/17 + 1/16 assuming that there were no repeated destinations.

↳

based on question: P(all 4 ahead of you want to get off on 20th fl) = (1/19)^4 real life(all 4 want to get off on 20th fl, and one of them is the first person press the button to 20th fl, and that leave all others, including you, stay still): (1/19) * (1/4) Less

### Suppose there is a rectangular map where you can only travel up or right to go from a start location in the bottom left corner to the top right corner, and each move is discrete. Write a program that prints all possible solutions to get from the start to finish.

4 Answers↳

#include using namespace std; const int maxx = 5; const int maxy = 5; void printpath(int x = 1, int y = 1, string path = "") { if(x Less

↳

Suppose you need 5 R (right moves) and 5 T (top moves) to reach the upper right corner. Then you can do a permutation of the string, "RRRRRTTTTT" to get all the possible paths. Less

↳

@Sid Ray: Thanks for the hint.

### Linked list memory management: deleting a node from the middle of a list was easy. Next question - how to delete a node from the end of a list. Was too tired to think and realize this was a trick question.

4 Answers↳

check node->next->next equals to null or not, then can just update node->next = null Less

↳

I guess this question makes sense only when we don't know the Head node !

↳

You can't, since the pointer already points to null. No way around it.

### I've been asked three questions. The only one I missed is quite a basic question:If you want to do something before Java GC recycle the object?

3 Answers↳

Just simply override the Finalize() function.

↳

Not quite. Finalize() is unreliable, in some cases it is not called (e.g. when exiting the application and shutting down the runtime). If you want to call something every time reliably (aka destructor in C++) use the reliable try/finally block. The question does not say that it needs to be run "right before GC", just "before GC". And because you cannot call any method after GC (other than fiddling with Unsafe), everything you call at any time during the program execution is called "before GC". Less

↳

override finalize() method. This is the method called right before GC recycle the object Less

### Write a function to convert First Name, Last Name to Last Name, First Name.

3 Answers↳

#include using namespace std; void swap (string * first, string * last); int main () { string first, last; cout > first; cout > last; swap (&first, &last); cout << "Swapping your first and last name." << endl; cout << "Your first name is now " << first << "." << endl; cout << "Your last name is now " << last << "." << endl; return 0; } void swap (string * pfirst, string * plast) { string temp = *pfirst; *pfirst = *plast; *plast = temp; } Less

↳

To be precise I forgot to add: // above swap (&first, &last) cout << "Your name is " << first << ", " << last << endl; // replace above return 0; cout << Your name is now " << first << ", " << last << endl; You don't have to pass by reference, you could have just used the swap function to reverse the order of the first and last name, but this is more impressive for an interview! Less

↳

You can do it inplace my swapping the last and first char and then shifting the start index and rest string by one place each time. Less

### What is put option?

3 Answers↳

An insurance that you pay to hedge against price changes in the future. buy put to hedge against price going down. Less

↳

Where you “put” options on high or low before a date

↳

A put option is a right but not obligation to sell the underlying asset at the strike price at maturity. One put option contains 100 shares of the underlying asset. A put option can be an effective tool for managing risk and uncertainty. Using a protective put one can hedge the potential downside risk of the portfolio, with only giving up a small portion of the upside potential, which is the premium paid for the option(s). This is known as the breakeven point. Less

### if A! + B! + C! = ABC and A, B, C are single digit numbers, find A, B, and C.

2 Answers↳

145. You don't need to check for 0. You don't need to check for any number >=6 (6! = 720, therefore 6! + B! + C! will be greater than 720. Thus, ABC needs to be greater than 720. But even if we assume A = 6, the number cannot be greater than 654, assuming that there are no repetitions in the digits). Thus, we're reduced to [1, 5]. Now, 5! + 4! + 3! = 120 + 24 + 6 = 150. Thus, we know that the first digit of the number has to be a 1. So we're left with just 12 combinations for B and C and 145 seems to fit pretty well :) PS: This is under the assumption that the digits are unique. Less

↳

#include int factorial (int n) { int i, f = 1; for (i = 2; i <= n; i++) { f = f * i; } return f; } int main() { int a,b,c; for (a=0; a < 10; a++) for (b=0; b < 10; b++) for (c=0; c < 10; c++) { int af = factorial (a); int bf = factorial (b); int cf = factorial (c); int sum = af + bf + cf; if (sum == (100*a + 10*b +c)) { printf ("A = %d, B = %d, C = %d\n", a, b, c); return 1; } } return 0; } Less

### what is the best way to find the duplicates within two intersecting linked list?

3 Answers↳

Well, they didn't want me to use hashtable when I mentioned hashtable. http://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/ . What they wanted to hear was the Method 2, where you mark visited nodes. Less

↳

Use a hashtable?

↳

Hashtable is unnecessary if the linked list is sorted. Use a modified version of the merge algorithm for merge sort. You can get it in O(n) time without extra work. Less