Goldman Sachs
10+ Vertex Interview Questions and Answers
Q1. Maximum of All Subarrays of Size K
Given an array of non-negative integers and an integer K representing the length of a subarray, your task is to determine the maximum elements for each subarray of size K.
Exa...read more
Q2. LRU Cache Design Problem Statement
Design and implement a data structure for a Least Recently Used (LRU) cache that supports the following operations:
get(key)
- Retrieve the value associated with the specifie...read more
Q3. Serialization and Deserialization of an N-ary Tree
Given an N-ary tree where each node has at most 'N' child nodes, the task is to serialize the tree into a sequence of bits and then deserialize it back to reco...read more
Q4. Design a Constant Time Data Structure
Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:
1. INSERT(key, value): Add or update the inte...read more
Q5. Simplify Directory Path Problem Statement
You are provided with a directory path in Unix-style notation, and your task is to simplify it according to given rules.
In a Unix-style file system:
- A dot (.) refers ...read more
Q6. what is virtual memory? Will we need virtual memory even if we have infinite amount of RAM?
Virtual memory is a memory management technique that allows a computer to use more memory than it physically has.
Virtual memory uses a combination of RAM and hard disk space to store data.
It allows programs to use more memory than is physically available.
If a program tries to access memory that is not currently in RAM, it will be swapped in from the hard disk.
Even if we had infinite RAM, virtual memory would still be necessary for certain tasks such as memory isolation and pr...read more
Q7. Given an array, Find out maximum length of subarray where max of subarray <= 2*min of subarray
Find maximum length of subarray where max <= 2*min.
Iterate through array and keep track of max and min values.
Update max length when condition is met.
Time complexity: O(n)
Q9. Create BST from incoming stream of nodes
Create a Binary Search Tree (BST) from an incoming stream of nodes.
Start with an empty BST
For each incoming node, compare it with the root node and insert it accordingly
Repeat the process until all nodes are inserted
Q10. Implement LRU cache.
Implement LRU cache
LRU stands for Least Recently Used
It is a cache eviction policy that removes the least recently used item
It can be implemented using a doubly linked list and a hash map
Newly accessed items are moved to the front of the list
When the cache is full, the item at the end of the list is removed
Q11. Trapping rainwater problem
Trapping rainwater problem
The problem involves calculating the amount of rainwater that can be trapped between bars in an elevation map
Use two pointers approach to calculate the water trapped at each bar
Keep track of the maximum height on the left and right of each bar to calculate the trapped water
Q12. Serach in sorted n*n matrix
Search for a target value in a sorted n*n matrix.
Start from the top-right corner or bottom-left corner of the matrix.
Compare the target value with the current element and move left or down accordingly.
Repeat until the target value is found or the boundaries of the matrix are crossed.
More about working at Goldman Sachs
Interview Process at Vertex
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month