Open In App

# Goldman Sachs Interview Experience | Off-Campus (1+ yr experienced)

For Software Developer role (Analyst) :

Round 1:  Online Coding Round

2 Coding Questions in 2 hour time limit.

Q1.  Given a number ‘x’, and a range of ‘y’ to ‘z’. Find the count of all numbers ‘n’ in that range such that the product of the number ‘n’ and ‘x’ does not contain any digit from the number ‘n’. Foreg if x=2, y=11, z=13, then,

• for n=11, 2*11=22  //valid
• for n=12, 2*12=24  //invalid as 24 contains 2 from n=12
• for n=13, 2*13=26  //valid

Q2.  A man is travelling from city A to city B. He starts with X amount of money. Everyday he spends some money and also he may work on some days to earn money. He may earn more than he spends on same day or he may spend more than what he earn on same day. You are given an array of integers which represent his net savings (earning-expense), find minimum amount of money he should begin with to ensure that he always have some money (>0) at the end of any day. ( https://www.geeksforgeeks.org/minimum-initial-energy-required-to-cross-street/ )

2 Coding Questions in 1 hour and brief discussion of the approach with the interviewer. Also write test for the code to run test cases.

1. Implement Deque class and its methods in Java (approach taken using doubly ended queue).
2. Trapping Rain Water: https://www.geeksforgeeks.org/trapping-rain-water/

Round 3:  Interview Round – Technical

1. Asked about doubly linked list and how it works. Since it takes space, how would you optimize it by using single pointer ( I gave solution using XOR linked list ).
2. Implement LRU Cache ( https://www.geeksforgeeks.org/lru-cache-implementation/ ).
3. Difference between Comparator and Comparable. Given a user-defined class Employee and list of employees, sort the list according to the age of employees. What you will use to sort, comparator or comparable and Why? How will you decide when to use comparable and when to use comparator?
5. Difference between == and equals().
6. Internal working of HashMap in java. When to override equals() and when to override hashCode() method.

Round 4:  Interview Round – Technical

1. Given n, write recursive code to print fibonacci series upto n ( https://www.geeksforgeeks.org/tail-recursion-fibonacci/ ).
2. Given length n, print all possible binary strings of length n ( https://www.geeksforgeeks.org/generate-all-the-binary-strings-of-n-bits/ ).
3. Given time hh:mm. Find angle between minute and hour hand of clock. (https://www.geeksforgeeks.org/calculate-angle-hour-hand-minute-hand/)
4. Given a largest dictionary of words, which data structure you would use to design a search option such that when you search for let say “typ”, it gives possible results from dictionary such as “typed”,”typing” etc. (I said Trie)
5. Given two strings S and T. Find smallest substring in S which contains all characters of T.(https://www.geeksforgeeks.org/find-the-smallest-window-in-a-string-containing-all-characters-of-another-string/)

Round 5:  Interview Round – Technical

1. Given two link list where every node in link list denotes a single digit number. Find sum of both link list. Foreg- List A:  1->2->3, List B:  9->1->5, then sum will be:  1->0->3->8. (https://www.geeksforgeeks.org/add-two-numbers-represented-by-linked-lists/)
2. In a single-threaded environment, find first non-repeating character in a string. (https://www.geeksforgeeks.org/given-a-string-find-its-first-non-repeating-character/)
3. In a multi-threaded environment ( 4 threads ), find first non-repeating character in a long string and each thread should perform independently and concurrently. ( I divide the string into 4 substrings and let each thread resolve it independently in parallel and store index of non repeating char of substrings in hashmap and then return all 4 hashmaps to main thread. Then main thread will read 4 hashmaps and find final result of first non repeating character )
4. How will you write tests for a function (unit tests). Asked about mocking and patching.
5. Asked about dependency injection (due to my project on spring) and does it improves testing your application? If yes, How?