Goldman Sachs Interview Questions
Practice with real Goldman Sachs interview questions
01
A Software Engineer was asked
Asked in 2024
Q. How would you reverse a linked list in Python? Provide a sample implementation along with edge case handling.
Ans. To reverse a linked list, we need to change the direction of the
next pointers for each node. Here's a sample implementation:
In this implementation, we first append values to the linked list. The reverse function iteratively reverses the links until we reach the end of the list. Edge cases such as an empty list are handled since the method will simply do nothing if self.head is None.Software EngineerCore Concept
02
A Backend Developer was asked
Asked in 2024
Q. Explain SQL Joins with examples and how you would use a GROUP BY clause in a database query.
Ans. SQL Joins are used to combine rows from two or more tables based on a related column. Here are examples of different types of joins:
1. INNER JOIN: Returns records that have matching values in both tables.
2. LEFT JOIN: Returns all records from the left table, and matched records from the right table. If no match, NULL values are returned for right table columns.
3. RIGHT JOIN: Returns all records from the right table, and matched records from the left table. If no match, NULL values are returned for left table columns.
4. FULL OUTER JOIN: Returns all records when there is a match in either left or right table records.
The
GROUP BY clause groups rows that have the same values in specified columns into summary rows. It is often used with aggregate functions like COUNT, SUM, AVG, etc. Here’s an example:
This query counts the total number of orders for each customer by grouping the results by customer_id.Backend DeveloperCore Concept
