Interview questions

Questions I've actually been asked, across different companies and interview rounds, tagged by the tech they touched. Filter by whatever you're prepping for.

Company
Round
Tech stack

Goldman Sachs CoderPad - Technical Screen

Binary Tree to String Serialization (Custom Format)

Write a function to convert a binary tree into a specific string representation using pre-order traversal. The format must follow a nested parenthesis structure: (root, left_subtree, right_subtree). If a node is a leaf (or if a child is missing), the format should adapt accordingly based on the provided examples.

DSATreeRecursionString
Goldman Sachs CoderPad - Technical Screen

Cloud Kitchen (Optimal Delivery Assignment)

A cloud kitchen has N orders and N delivery partners. You are given an N x N cost matrix where matrix[i][j] represents the cost/distance for Delivery Partner i to deliver Order j. Find the optimal assignment of orders to delivery partners such that exactly one order is assigned to each partner and the total delivery cost is minimized.

DSADynamic ProgrammingBitmaskingGraph
Goldman Sachs CoderPad - Technical Screen

Best Average Grade

Given a list of student test scores, find the best average grade. Each student may have more than one test score in the list.

Complete the bestAverageGrade function. It has one parameter, scores, which is an array of student test scores. Each element in the array is a two-element array of the form [student name, test score] (e.g. ["Bobby", "87"]). Test scores may be positive or negative integers.

If you end up with an average grade that is not an integer, use a floor function to return the largest integer less than or equal to the average. Return 0 for an empty input.

DSAHash TableMathArray
Goldman Sachs CoderPad - Technical Screen

Compute Snowpack (Trapping Rain Water)

Given an array of non-negative integers representing the elevations from the vertical cross-section of a range of hills, determine how many units of snow could be captured between the hills.

DSAArrayTwo PointersDynamic Programming