Open In App

Goldman Sachs Interview Experience for SDE 2023

Last Updated : 04 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Round 1(Online Test): It was an online 1-hour test. It had 10 questions out of which 8 were MCQ questions and two were coding questions. MCQ questions were related to OOPS, Aptitude, data structures, and minimum spanning tree. They shortlisted 17 students for interview

The coding questions: They were easy-medium level questions of leetcode, one was of competitive programming and the other was of the graph.

After this 3 interview rounds were scheduled one after another on the same day

INTERVIEW ROUNDS:

Round 1 (Technical Interview Round 1): It was a technical round. Firstly, I was asked some probability questions for general aptitude testing.

Question: Given two coins, what is the probability of getting at least one head? It was a basic question and i answered it 3/4, after that he tried to confuse me and said what if the first coin always has a get? I directly jumped into conditional probability and solved using that and answered 1/2. The interviewer asked me that was there a need to apply conditional probability, it was then that I realized that the two events were independent so I explained to him we can directly write it as 1*1/2 since 1st coin always has a head.

Then I was asked questions about my machine learning project from the last semester. he asked basic questions like why i used CNN over ANN and the differences between the two

coding questions were asked:

Question: Suppose there is an array (0,2,2,2,3,3,7,8). Then output the range where a number k lies:-

I instantly told the brute force approach of initializing st=-1, en which will denote the starting and ending values of the range.

the basic conditions were:

C++




#include <iostream>
using namespace std;
  
vector<int> call(vector<int> &arr,int k){
      
    int st=-1,en;
    for(int i=0;i<arr.size();i++){
      if(arr[i]==k && st==-1) st=i;
      else if(arr[i]==k) en=k;
    }
    return {st,en};
}


so then he asked me about time complexity which is O(n) and asked me to optimize it. I optimized it with binary search, and in the end, he said there were two bugs in my code. i successfully detected the first bug but since time was up I couldn’t find the second bug but he seemed satisfied.

Round 2 (Technical Interview Round 1): It was a coding round. The interviewer was different this time and I was asked two questions.

1st Question: https://www.geeksforgeeks.org/search-a-word-in-a-2d-grid-of-characters/

This is a popular leetcode problem, I was stuck a bit at first and gave a normal brute force answer with dfs traversal and storing all possible paths. The interviewer was very helpful at every step and he asked me to optimize my answer, so I proceeded step by step.

I wasn’t asked to code this just the pseudocode and the algorithm was asked.

2nd Question: A child is running up a staircase with n steps and can hop either 1 step, 2 steps or 3 steps at a time. Implement a method to count how many possible ways the child can run up the stairs.

link for the same: https://www.geeksforgeeks.org/count-ways-reach-nth-stair-using-step-1-2-3/

I successfully told the recursive solution and memoized it to give a dp solution, he asked me the reasoning for a particular line of code at each step and asked the difference between bottom-up and top-down methods and I explained it to him.

Round 3 (HR round): It was more of an HR round. The interviewer was different this time and I was asked general questions with one coding question.

We had a good 20 minutes discussion where he asked me questions like ‘Why Goldman Sachs?’, ‘What is your dream company?’, ‘Why this particular role?’, ‘What if you don’t get selected?’.

It was basically an informal discussion and the interviewer seemed quite friendly. In the last, i was asked a question.

1st Question: Given an array with unique elements, you have to define a function to shuffle the array

I simply said that the simplest possible way is to swap the first two elements since that will also shuffle the array. He asked me if i want to call this function 10 times and it should generate a random shuffled array every time and it should be unique.

I then told him we can use the inbuilt random function to shuffle. Overall I explained to him well and also talked about base cases like when n==1 and also discussed some cases that might result in segmentation error. He was happy I provided many different approaches, In the end, he told me a further optimal approach where he used random functions on indexes which I didn’t understand though but i nodded 😉

I got selected after the three rounds.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads