Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Goldman Sachs interview experience Real time questions & tips from candidates to crack your interview

3 rounds | 7 Coding
problems

Journey

I started doing coding in Java by taking course from coding ninjas in 2nd year. Before this I was exploring different programming like python, c++ , java. So I choose java. After completing the course i started practicing on geeksforgeeks and leetcode. After this in 3rd year I have made mini project. I have also taken inhouse training on ML.

Application story

I have applied through Hackerrank.com. After applying, my resume got shortlisted, and I got a test link. After the test, I got an interview link for the discussion round. After that I got mail.

Why selected/rejected for the role?

I got rejected because I was not able to give a proper optimized approach for coding questions and SQL queries. I got rejected in 3rd round.

Preparation

Duration: 2 months

Topics: Data Structures, CPP, Algorithms, PUZZLES, Operating systems, DBMS.

Tip

Tip 1 : Revise all the coding interview questions that you have solved so far in the last few days

Tip 2 : Practice writing the codes on paper with clarity

Tip 3 : Mention only those thing that you know in your CV and revise your projects nd everything you have mentioned on your resume thoroughly.

Application process

Where: Hackerrank

Eligibility: No criteria

Resume tip

Tip 1 : Do not even mention topics you have no idea about

Tip 2 : you should have some projects on resume and you should be able to explain clearly why you have chosen the particular project, what does it do, its functionality, outcomes and everything about each of the projects.

Tip 3 : Tailor your resume according to the needs/the role you are applying for

01

Round

Medium

Online Coding Interview

Duration120 minutes

Interview date10 Sep 2020

Coding problem3

A 120-minute online test was conducted on HackerRank which had the following format:

1st Section :

2 Coding questions(30 minutes)

2nd Section :

10 MCQ questions(30 minutes)

3rd Section :

1 Advanced Programming Question(45 minutes)

4th Section :

2 Subjective Questions(15 minutes)

The coding questions and MCQ questions were a bit tricky so you need to manage your time properly and try to solve all the questions correctly..

Technical – included c and c++ output question, os(scheduling, semaphore), dbms(normal form, etc).

There are N people in a party, they might or might not know each other names.

There is a celebrity in the group, celebrity does not know anyone and all people know the celebrity.We can only ask questions like “does A know B?”. (Celebrity problem)

What is the worst case time complexity of the optimal solution to find the celebrity?

O(n)

Let’s say we ask “does A know B?”. If A knows B, A can not be a celebrity.If A does not know B then B can not be a celebrity. So after each question, we can reject one person. Thus we need to ask a maximum of n questions to correctly figure out the celebrity.

Problem approach

Approach: The idea is to use two pointers, one from start and one from the end. Assume the start person is A, and the end person is B. If A knows B, then A must not be the celebrity. Else, B must not be the celebrity. At the end of the loop, only one index will be left as a celebrity. Go through each person again and check whether this is the celebrity.

The Two Pointer approach can be used where two pointers can be assigned, one at the start and other at the end and the elements can be compared and the search space can be reduced.

Algorithm :

Create two indices a and b, where a = 0 and b = n-1

Run a loop until a is less than b.

Check if a knows b, then a can’t be celebrity. so increment a, i.e. a++

Else b cannot be celebrity, so decrement b, i.e. b–

Assign a as the celebrity

Run a loop from 0 to n-1 and find the count of persons who knows the celebrity and the number of people whom the celebrity knows. if the count of persons who knows the celebrity is n-1 and the count of people whom the celebrity knows is 0 then return the id of celebrity else return -1.

complexity analysis for this implementation:

Complexity Analysis:

Time Complexity: O(n).

Total number of comparisons 2(N-1), so the time complexity is O(n).

Space Complexity : O(1).

No extra space is required.

Save this for later

```
N = 9
‘9’ can be represented as:
2 + 3 + 4 = 9
4 + 5 = 9
The number of ways to represent ‘9’ as a sum of consecutive natural numbers is ‘2’. So, the answer is ‘2’.
```

```
1. The numbers used to represent ‘N’ should be natural numbers (Integers greater than equal to 1).
```

Problem approach

Suppose we start our summation series from 1 i.e. 1+2+3+…..

Max no. of numbers whose summation will be less than or equal to N: floor(X)

where X*(X+1)/2=N

So N as a sum of positive consecutive integers will at max consist of X numbers.

Here we can check each possibility k(assume) between 2 and X (both inclusive) and to check we can use the concept of A.P. as the summation series is an A.P whose sum is N.

We know the no. of term in A.P, n: k

Sum of A.P, S: N

Common difference, d: 1

We can easily calculate the first term a, using formula:

S=n/2*(2a + (n-1)d)

If a is an integer then N can be represented as a sum of k continuous integers, otherwise, it is not possible. Count the number of occurrences when a is an integer and that is our answer.

Time Complexity: Loop run X time which is O(sqrt(N)) and in each iteration, we take O(1) time. So overall time complexity is O(sqrt(N)).

Save this for later

```
Given array/list can contain duplicate elements.
(arr[i],arr[j]) and (arr[j],arr[i]) are considered same.
```

Save this for later

02

Round

Medium

Video Call

Duration45 minutes

Interview date12 Nov 2020

Coding problem2

interview started with a typical tell me about yourself question. The interviewer was nice and friendly.

He asked me to explain a little about my projects (only basics).

Which all data structures you know and my favourite data structure. I replied with a linked list.

He asked the difference between array and linked list, time complexities of insertion, deletion, etc. in both of them. Then he asked about sorting an array, different algorithms, and their time complexities.

How would you sort a linked list? How would you find the middle of the linked list in one pass? How would you merge two linked lists (I had to write code for the same)?

Then he asked how would you be able to manage the business and finance decisions at GS.

Tell me an incident when you had the chance to display your leadership skills.

Lastly, I was allowed to ask questions from the interviewer.

Explain linked list and operations on linked list. (Learn)

```
4 and 7 are cousins of each other since they are at the same level and have different parents, 3 and 2 respectively.
```

Problem approach

intially a solution that finds whether given nodes are cousins or not by performing three traversals of binary tree has been discussed. next after asking for any different or optimal way to solve the same question by interviewer,

the approach to solve the problem by performing level order traversal is discussed . The idea was to use a queue to perform level order traversal, in which each queue element is a pair of node and parent of that node. For each node visited in level order traversal, check if that node is either first given node or second given node. If any node is found store parent of that node. While performing level order traversal, one level is traversed at a time. If both nodes are found in given level, then their parent values are compared to check if they are siblings or not. If one node is found in given level and another is not found, then given nodes are not cousins.

Save this for later

03

Round

Medium

Video Call

Duration45 minutes

Interview date14 Nov 2020

Coding problem2

This round was relatively short and mostly consisted of coding (on hackerrank’s codepair platform)

The interviewer asked me about my previous interview and what all questions were asked in it.

Then there was a discussion about my projects and the technologies used in them. How would you deploy an application and what happens in the process of entering a keyword in the browser and loading your requested page?

He asked me to write the code for finding the middle of a linked list in one pass.

After that, I had to write the code for the implementation of a queue. I first discussed the approaches with him using array and linked lists for some time. They wrote the code using a linked list by taking head and tail pointer.

He was satisfied with it and the round ended with me asking him the questions I had.

Problem approach

Traverse linked list using two pointers. Move one pointer by one and the other pointers by two. When the fast pointer reaches the end slow pointer will reach the middle of the linked list.

Save this for later

Explain queue. (Learn)

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

What does an alias do in SQL?

Choose another skill to practice

Similar interview experiences

SDE - Intern

3 rounds | 5 problems

Interviewed by Goldman Sachs

2040 views

0 comments

0 upvotes

SDE - Intern

3 rounds | 11 problems

Interviewed by Goldman Sachs

5424 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Goldman Sachs

689 views

1 comments

0 upvotes

SDE - Intern

4 rounds | 7 problems

Interviewed by Goldman Sachs

517 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - Intern

3 rounds | 6 problems

Interviewed by Amazon

13329 views

4 comments

0 upvotes

SDE - Intern

4 rounds | 7 problems

Interviewed by Microsoft

12347 views

1 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Amazon

8899 views

2 comments

0 upvotes