# Goldman Sachs Interview Experience | Set 36 (For Experienced)

I have interviewed with Goldmanc sachs in Nov-17. The process  is very slow as in my case first round was started in Sept-17 and last round ended in Nov-17.

Round 1: First was the HackerRank Test. Two Coding questions, first easy ,second Medium to Hard Level.

Note: I do not remember the exact wording of the question.

1.)  Given an string and a burst length , output the string such that count of same adjacent characters in string are less than burst length.

Example:

Input : abbcaaaccd , 3

Output: abbd

2.) Given an array of distinct integers, output the number of sub-sequences of length 3, either in increasing or decreasing order.

Tips: Prepare Dynamic Programming as almost every time second question is of DP.

Here two questions were asked :

1.  A robot can only move in four directions , UP(U), DOWN(D),LEFT(L),RIGHT(R). Given a string consisting of instructions to move , output the co-ordinates of robot after the executing the instructions. Initial position of robot is at origin(0,0).
2. Given an array of integers and a sum, output the number of pairs  whose addition is equal to the given sum.

Tips: In  CoderPad round first discuss your algorithm with the interviewer. Interviewer excepts you to write professional level code. Also interviewer will ask you to write all possible test cases especially corner test cases and your code should pass it.

Round 3: Video Conference

In this round lots of technical questions were asked to check to in-depth knowledge of the C++ language.

Some questions i remember are:

1. Introduce yourself
2. What is Virtual keyword, how vtable works, virtual destructor.
3. Exception handling in C++, C++14(if you claim to know c++14)
4. Lots of scenarios related to run-time polymorphism   are given and asked what will be the output and why
5. STL containers Map, Set, unordered_map.
6. Difference between map and unordered_map in C++, their implementation details.
7. Real world uses of map, set, unordered_map.
8. Thread safety of STL containers.
9. smart pointers like unique_ptr, shared_ptr, weak_ptr. Usecases and differences among them.
10. Algorithm Question: Given a matrix of integers , find the sub matrix with the maximum sum.

After this round and a month wait, i was called for face to face discussion in GS Bangalore. All the below round were happened in GS Bangalore and in single day. For each round there were two interviewers.

Round 4:  Face to Face

Again lots of questions on C++ :

1. Virtual mechanism
2. Pure Virtual function uses
3. Pure virtual function vs virtual function
4. Output prediction : Given some C++ code , what will be output and why.( I do not remember the exact questions but one case was of run-time polymorphism and second one was of local reference returned from a function)
5. Algorithm questions
• Given an array of integers find the maximum sub-array. Output the sum with start-end index.
• Given a matrix filled with X and 0(zero). Calculate the distance from nearest 0 for all cells marked with X.The distance of four neighboring cells(top,bottom,right,left) will be 1. For exampleInput:X X X
X 0 X
X X X

Output:
2 1 2
1 0 1
2 1 2

Round 5

C++ questions :

2. Different types of cast and difference between them
3. Up Cast and Down cast, why and how they works.
4. Diamond problem and how to resolve it.
5. How virtual inheritance works internally.
6. Algorithm questions :
• Given a linked list with only three possible numbers 0,1,2, sort the list.
• Given a array of sorted but repeated integers , find the number of occurrence of a given number.

Round 6

Design Question  : Design a mobile directory i.e. the list of contacts to save mobile number , email and other information. All operations which we can do in our mobile like searching by name , number etc.

Algorithm Question : Given two strings s1, s2. output all the ways in which these two strings can be merged while keeping the order of character same as they were in s1, s2. Design a recursive algorithm.

Example : s1 : ab , s2: cd

Output :

abcd

acbd

acdb

cabd