Goldman Sachs Interview Experience for Associate

CoderPad:

Find a cycle in an array: You are given an integer array of size N.

Every element of the array is greater than or equal to 0.

Starting from arr[startIndex], follow each element to the index it points to. Continue to do this until you find a cycle.

Return the length of the cycle. If no cycle is found return -1

Examples:

countLengthOfCycle([1, 0], 1) == 2 ,

countLengthOfCycle([1, 2, 0], 0) == 3

Given an array scores[][]= [{“jerry”,”65”},{“bob”,”91”}, {“jerry”,”23”}, {“Eric”,”83”}]

Find the highest average score, in this case, its 91 of BOB. Numbers can be negative as well.

SuperDay:

Round1:

What is LinkedList? When do you choose LinkedList over ArrayList?

Given a linkedlist 1->2->3->4->5, return a new linkedlist with every alternate element, odd indexed element if starting as 0-indexed, being added at the last. New linkedList will look like: 1->3->5->2->4

Question on anagram:

Group anagrams from list of strings

eg: I/P: [“dog”, “god”, “cat”,”act”,”abc”,”tac”] O/P: {{“dog”,”god”}, {“cat”,”act”,”tac”},{“abc”}}

Round2:

Latest project/feature developed in current org and it’s impact.

Given an array of integers, positive negative both. Return the product of all values at each index excluding that index’s value. Emphasized on the test cases.

In a network, there are lot’s of users coming to access a resource, which data structure will you use to store each user’s data.

Given a binary tree consisting of only 0’s and 1’s. Find a subtree in which number of 0s and 1s are equal and return true, else return false.

Result: Rejected, no further rounds


Contact Us