# Interview Experience for Goldman Sachs

Recently, Goldman Sachs conducted its drive at NSIT. We congratulate, Saksham Nagpal, one of our studnets from Algo++ for clearing all the rounds and making it into GS.

**ROUND 1**:

**Q1**: You are given an array of numbers representing stock prices at a particular time eg [2,16,1,5,12,8]. You buy a stock at a particular price at one time and sell it at other price at a later time.. You have to tell the maximum profit which is 14 here (you cannot buy at 1 and sell it at 16 because price was 1 afterwards and 16 was at earlier time of the day)

**Q2**: Given a number, return an array consisting of all it’s prime factors.

**Q3** : 100 doors puzzle… Watch it here

**ROUND 2**:

**Q1**: Given a number, if it is prime and has the digits 1,2,3 in it then return true, otherwise false. Eg 21103 should return true

**Q2** : Given a stack of nos, give the minimum number in stack without losing the elements and using a second stack.

**ROUND 3**:

**Q1**: Which type of tree (AVL or red black) do the stl hashmaps use?

**Q2**: Given an array of numbers, you have to concatenate all of them to make the largest number. Eg [9,123,44,89] will make 98944123.

**Q3** : Given an array and a number k, find the number of pairs that sum to k.

That was all!