Goldman Sachs Interview Experience (On Campus 2020)
Round 1: It was an oncampus hiring event. Around 700 students appeared for the first round i.e the Coding Round on Hackerrank. The coding round consisted of the various sections having 2 easy coding questions and 1 hard question, around 8 MCQs of basic mathematical aptitude and 8 MCQs on CS Fundamentals. I was able to solve all the MCQs and 2.5 coding questions. Around 10 people were shortlisted for the interview rounds.
MCQs were basic and solvable. The coding questions were:

N number of strings is given. Divide each string into two halves, and determine if the letters in the right half of the string can be rearranged to form a palindrome or not. All the letters must be used to create the palindrome. Print Y in case a palindrome can be formed, and N in case a palindrome cannot be formed. In case the length of the input string is odd the split should happen such that the right half has one letter more than the left half

Consider a binary tree of N nodes (1 Root and N1 descendants). A node in this tree is called a Magic parent if the sum of one subtree (either left or right) of the node is even, and the sum of the other is odd. The nodes having only one or no child nodes can never be magic parents. The tree is represented as a series of relationships of each node to the Root node such as L, R, LL, LR.. and so on, where each node is left (L) to Root or leftleft (LL) or rightleft (RL) to Root and so on. Write a program to find all the Magic parents in the tree, and print their sum as the output.

Input Format: The first line of input contains an integer, N number of nodes in the tree The second line of input contains an Integer root which is the root of the tree.
The next N1 lines of input contain a string, S, and an integer, X separated by a single white space where X is a node in the tree and S is the relation between Root and X.

Output Format: The output contains the sum of all the Magic parent nodes in the tree

Sample Input:
9 11 L 23 R 44 LL 13 LR 9 RL 22 RR 7 RLL 6 RLR 15

Sample Output:
33


It’s a friendship day! Deepika is keen to wish her friend Jyoti with a special bouquet of flowers which she knows Jyoti loves. This bouquet can only be made with a combination of some special flowers and will be incomplete if even one of the flowers is missing. These flowers are sold in different shops across town, and Deepika plans to visit these shops on her way from her home to Jyoti’s office. Each shop sells only one kind of flower, and Deepika doesn’t want to waste time, so she needs to visit exactly one shop selling each kind of flower before reaching Jyoti’s office. There is a flower shop next to Deepika’s home, and one next to Jyoti’s office, so she plans to visit those two anyways.
Help Deepika by finding the shortest path to collect all the flowers and reach Jyoti’s office, while visiting exactly one shop selling each kind of flower. You can assume that at least one such path always exists.

Input format: Multiple inputs in a single line are always separated by single white spaces. The shops are represented by their names as strings (length >=1), and the flowers are represented with numbers.
The first line of input has an integer n
Next, n lines have input in the following format: s f d x1 x2
where
s is the shop name
f is the flower type available in that shop
x1 x2 etc. are the shop names which are at d distance from s
If there is only one shop at distance d, then only x1 is given if there are multiple shops at the same distance, all such shops are listed out in the same line.
The last line of input will have u and v, where u is the first shop (where Deepika’s house is) and v is the last shop (where Jyoti’s office is).

Output Format: The output contains u, v, and the minimum distance Deepika has to travel to get all the flowers and reach Jyoti’s office.

Sample Input 1:
5 a 3 1 b e b 2 2 c c 1 1 d d 5 e 2 a d

Sample Output 1:
a d 4

Explanation:
The line “a 3 1 b e” is interpreted as follows: shop ‘a’ sells flower type 3 and is at 1 unit distance from shops ‘b’ and ‘e’
The line “d 5” is interpreted as follows: shop ‘d’ sells flower type 5 and there are no other shops connected to ‘d’ other than those already given in other lines. There are four kinds of flowers available in five different shops: shop sells 3, b and e sell 2, c sells 1 and d sells 5.
Deepika’s house is at “a” and Jyoti’s office is at “d”. The shortest path Deepika can take while collecting all flowers is abcd, which means she covers a distance of 4 units.

Round 2 (Interview): This round was conducted on Hackerrank Codepair and some standard questions were asked from all the candidates. Some of them were:
 Next Smaller Element
 Make maximum array elements distinct by at most k increments of 1 each. [O(n) using 2 ptr and prefix sums]
 Merge Overlapping Intervals
 Number of Islands
 Topological Sorting
 Other standard Geeksforgeeks questions
Round 3 (Interview):
 Meeting Scheduler
 Find Local Minima in array
 Print Top view of Binary Tree
 Print prefix sum array in O(logn) time complexity is given multiple processes and multiple threads in the system.
 Some more Medium Hard Geeksforgeeks Problems
Round 4(Interview):
 Word Break Problem
 Capacity to Ship within D days
 Text Justification (Leetcode)
 Some more standard questions (Hard)
There were some puzzles and questions on CS Fundamentals (OS, DBMS, OOPS), etc as well.
Finally, I was selected for the position.
Please Login to comment...