Goldman Sachs Coding Interview Questions
These are the coding problems tagged as asked at Goldman Sachs in interviews and online assessments reported by candidates. Use the list to see which topics repeat, then solve the problems in order of difficulty: basics first, then the intermediate and advanced ones.
Reported questions change over time and are not a guarantee of what you will be asked, so treat them as a map of the patterns Goldman Sachs tends to test rather than a list to memorise. For each problem, practise explaining your approach, its time and space cost and the edge cases before you write the code.
Coding problems
- Two Sum (Basic)
- Best Time to Buy and Sell Stock (Basic)
- Maximum Subarray (Intermediate)
- Valid Parentheses (Basic)
- Longest Substring Without Repeats (Intermediate)
- Product of Array Except Self (Intermediate)
- Move Zeroes (Basic)
- Climbing Stairs (Basic)
- House Robber (Intermediate)
- Coin Change (Intermediate)
- Longest Increasing Subsequence (Advanced)
- Reverse String (Basic)
- First Unique Character (Basic)
- Kth Largest Element (Intermediate)
- Majority Element (Basic)
- Missing Number (Basic)
- Minimum Size Subarray Sum (Intermediate)
- Longest Consecutive Sequence (Intermediate)
- Subarray Sum Equals K (Intermediate)
- Container With Most Water (Intermediate)
- Trapping Rain Water (Advanced)
- Decode Ways (Intermediate)
- Longest Palindromic Substring (Intermediate)
- Valid Anagram (Basic)
- Power of Two (Basic)
- Sort Colors (Basic)
- Third Maximum Number (Basic)
- Find Pivot Index (Basic)
- Largest Rectangle in Histogram (Advanced)
- Daily Temperatures (Intermediate)
- Reverse Words in a String (Basic)
- Integer to Roman (Intermediate)
- Roman to Integer (Intermediate)
- Excel Column Number (Basic)
- Power of Three (Basic)
- Count Primes (Intermediate)
- Search in a Rotated Sorted Array (Advanced)
- Minimum in a Rotated Sorted Array (Intermediate)
- Merge Intervals (Intermediate)
- Candy Distribution (Advanced)
- Valid Parenthesis With Wildcards (Advanced)
- Is Subsequence (Basic)
- Subarrays With Product Less Than K (Intermediate)
- Count Palindromic Substrings (Intermediate)
- Longest Substring With At Most K Letters (Intermediate)
- Maximum Events Attended (Intermediate)
- Shortest Bridge Between Two Islands (Intermediate)
- Tree Diameter (Advanced)
- Maximum Product Subarray (Intermediate)
- Subarray Sum Equals K (Intermediate)
- Minimum Path Sum (Intermediate)
- Partition Equal Subset Sum (Intermediate)
- Maximum Circular Subarray (Intermediate)
- Best Time to Buy and Sell Stock II (Intermediate)
- Next Permutation (Intermediate)
- Gas Station (Intermediate)
- Container With Most Water (Intermediate)
- Top K Frequent Values (Intermediate)
- Longest Palindromic Subsequence (Intermediate)
- Isomorphic Strings (Basic)
- Minimum Window Substring (Advanced)
- Shortest Path In Binary Grid (Intermediate)
- Course Schedule Feasible (Intermediate)
- Running Kth Largest (Intermediate)
- Weighted Job Scheduling (Intermediate)
- LRU Cache Operations (Basic)
- LFU Cache Operations (Intermediate)
- Minimum Number of Perfect Squares (Intermediate)
- Russian Doll Envelopes (Intermediate)
- Snapshot Array (Intermediate)
- Text Justification (Intermediate)
- Reverse Linked List (Basic)
- Merge Two Sorted Lists (Basic)
- Odd Even Linked List (Intermediate)
- Swap Nodes in Pairs (Intermediate)
- Reorder Linked List (Intermediate)
- Symmetric Tree (Basic)
- Validate Binary Search Tree (Intermediate)
- Binary Tree Maximum Path Sum (Advanced)
- Count Good Nodes in Binary Tree (Intermediate)
Related
- Company interview roadmaps
- Practice coding problems online
- System design interview questions
- SDE-2 interview preparation
- All interview question topics
Frequently asked questions
How should I use the Goldman Sachs problem list?
Sort by the topics you are weakest in, solve a problem under a timer, then read the explanation. Repeat until the patterns feel familiar, and finish with a mock interview.
Are these the exact Goldman Sachs interview questions?
They are problems candidates reported being asked. Companies rotate questions, so use them to learn the patterns, not to predict the exact question.