99 problems · 22 Easy, 66 Medium, 11 Hard · Ranked #13 of 458
Difficulty breakdown
22 Easy
22% · avg 23%
66 Medium
67% · avg 59%
11 Hard
11% · avg 18%
Top topics
array
62.6%
string
28.3%
hash-table
26.3%
dynamic-programming
22.2%
two-pointers
17.2%
math
17.2%
Interview profile
Based on 99 reported problems, Goldman Sachs interviews are in line with industry averages - 11% Hard vs 18% overall. The majority (67%) of questions are Medium difficulty, which is typical for companies that want to see solid fundamentals without excessive trick questions.
Compared to the industry average, Goldman Sachs puts unusual emphasis on quickselect (3% of problems, 2.9x the industry average), divide-and-conquer (6.1% of problems, 1.5x the industry average), prefix-sum (5.1% of problems, 1.5x the industry average). If you're short on time, these are the categories to double down on.
The most common topics are array (62.6%), string (28.3%), hash-table (26.3%), dynamic-programming (22.2%). Problems below are sorted by frequency, the ones at the top are asked most often.
All 99 problems
Problem
Difficulty
Frequency
Topics
Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).
We have two arrays arr1 and arr2 which are initially empty. You need to add positive integers to them such that they satisfy all the following conditions:
You are given a 0-indexed 2D integer array pairs where pairs[i] = [starti, endi]. An arrangement of pairs is valid if for every index i where 1 <= i < pairs.len...
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...
There is an m x n grid, where (0, 0) is the top-left cell and (m - 1, n - 1) is the bottom-right cell. You are given an integer array startPos where startPos =...
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length...
Given a string of digits s, return the number of palindromic subsequences of s having length 5. Since the answer may be very large, return it modulo 109 + 7.
Given a positive integer n, there exists a 0-indexed array called powers, composed of the minimum number of powers of 2 that sum to n. The array is sorted in no...
You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potio...
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see...
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...
Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If...
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i]...
The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two midd...
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of...
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a sing...
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such pos...
Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at al...
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical or...
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better...
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and num...
There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner...
Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <=...
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).
We have two arrays arr1 and arr2 which are initially empty. You need to add positive integers to them such that they satisfy all the following conditions:
You are given a 0-indexed 2D integer array pairs where pairs[i] = [starti, endi]. An arrangement of pairs is valid if for every index i where 1 <= i < pairs.len...
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...
There is an m x n grid, where (0, 0) is the top-left cell and (m - 1, n - 1) is the bottom-right cell. You are given an integer array startPos where startPos =...
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length...
Given a string of digits s, return the number of palindromic subsequences of s having length 5. Since the answer may be very large, return it modulo 109 + 7.
Given a positive integer n, there exists a 0-indexed array called powers, composed of the minimum number of powers of 2 that sum to n. The array is sorted in no...
You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potio...
You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see...
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...
Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If...
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i]...
The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two midd...
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of...
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a sing...
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such pos...
Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at al...
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical or...
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better...
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and num...
There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner...
Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <=...
EasyRare
arrayhash-tablesliding-window
How often are these problems asked?
Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent Goldman Sachs interviews.
Very Likely
75-100%
Likely
50-74%
Sometimes
25-49%
Rare
0-24%
Preparing for your Goldman Sachs coding interview
Goldman Sachs interviews focus heavily on array, string, hash-table problems. If you're short on time, these are the categories to prioritize. The problems on this page are sorted by frequency, so start from the top and work your way down.
Beyond solving problems, practice explaining your approach. Goldman Sachs interviewers care about your thought process - how you break down a problem, consider edge cases, and evaluate tradeoffs between solutions. A clean O(n) solution you can explain clearly beats an O(log n) solution you can't articulate.
What coding problems does Goldman Sachs ask in interviews?add
Goldman Sachs has been reported to ask 99 distinct coding problems. The most common topics are array, string, hash-table. 22 are Easy difficulty, 66 are Medium, and 11 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.
How hard are Goldman Sachs coding interviews?add
Based on 99 reported problems, Goldman Sachs interviews are in line with industry averages - 11% Hard vs 18% overall. 67% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.
How should I prepare for a Goldman Sachs coding interview?add
Start with the highest-frequency problems listed on this page. Focus on the core topics: array, string, hash-table. Practice solving them under time pressure and explaining your approach out loud. Mock interviews with AI can simulate the real experience.
Simulate a real Goldman Sachs coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.