Goldman Sachs Interview Experience ( 4 yrs Experienced )

There was a certain call from a consultancy firm which picked my profile from naukri portal and called me regarding Goldman Sachs for C++ developer and 3-5 yrs of experience.

Round 1: Hacker Rank Round

This round consisted of 2 hacker rank questions and time was given as 2 hours to complete the round



  1. Find the number of positional elements in the given matrix. Return -1 if there is more than one occurrences of any positional element in the corresponding row or column. (This question is same as given on GeeksForGeeks except the condition given for occurrences of positional element : find-number-of-positional-elements)
    I was able to solve this using same approach
  2. Encode/Decode the string based on the input. The output should be based on the key. There are following 3 inputs from the user:int (operation o-for encode, 1-for decode)
    string (input string – word which is to be encode/decode)
    string (key to encode/decode e.g. 123)e.g.
    Input:
    0
    open
    123
    Expected output:
    oppeeen

    For encoding the letters in the output  should be repeated based on the key e.g. in above example o is repeated 1 time, p is repeated 2 times, e is repeated 3 times & rest of the string is same as in input. In case key is larger then ignore the extra letters which are more than the input string length. Similar way to decode. return -1 in case of all the exceptions.
    I was able to solve this problem but the test case keeps on failing until i realize that while entering a string for decode user may input some wrong string which can’t be decoded using the given key like as if key is 123 and input string is “oppxn”. Now there are no 3 occurrences in the string so there should be error returned in this case.

All the test cases were passed for both of the questions and later i got a call for coder pad round.

Round 2: Coder pad round

Interviewer was expected to call at 11:00 am but I got a call at 11:20 and interviewer was polite and took approx 5 minutes to go through the questions and supplied one question to me.

  1. Find the first non-repeating character in the integer array. This question is similar to the given in geeksforgeeks : First non-repeating character
    Initially i solved this question using 2 arrays which has the complexity for O(n^2) but he then told me to simplify then i was able to do so in O(2n). After solving this question i was given another question
  2. Given a dictionary of the words(strings) which contains different words & you are given an input string e.g. “abd”. You need to find the largest word available in the supplied dictionary which can be made using the letters of input string. The returned word can contain only the same no of occurrences of the letters as given in the input string i.e. if a letter is given once then in the output it should be existed only once. Examples:
    1. Dictionary {“to”, “banana”, “toe”, “dogs”, “ababcd”, “elephant”} and input string is “eot”. Output should be “toe”
    2. Dictionary is same as specified in example a but the input string is “ogtdes” and the output is “dogs” and “toes”

I was not able to solve this one I told him the brute-force approach but that was very vague and I don’t think he was very much impressed with me. He told me that HR will get back to me but I didn’t got any call.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.