GS 2025 Papers
Latest papers. View 2025 Papers →
Goldman Sachs placement papers 2024 with actual HackerRank assessment questions, DSA problems, and solutions for Engineering Analyst role.
This page contains actual Goldman Sachs placement papers from 2024 with 30+ questions from HackerRank assessment and interviews.
| Round | Duration | Content |
|---|---|---|
| HackerRank OA | 120 min | 2-3 coding + aptitude MCQs |
| Technical 1 | 60 min | DSA + project |
| Technical 2 | 60 min | DSA + CS fundamentals |
| HR | 45 min | Behavioral + finance interest |
Answer: 4/8 = 1/2
Explanation: HHH, HHT, HTH, THH = 4 outcomes out of 8
Answer: 10000 × (1.08)² = $11,664
Answer: P/E × EPS = 20 × 5 = $100
Answer: 7! = 5040
Answer: (121/100)^(1/2) - 1 = 1.1 - 1 = 10%
Difficulty: Medium
Time: 30 minutes
Find maximum profit from buying and selling stock once.
Input: [7,1,5,3,6,4]
Output: 5 (buy at 1, sell at 6)
public int maxProfit(int[] prices) { int minPrice = Integer.MAX_VALUE; int maxProfit = 0; for (int price : prices) { if (price < minPrice) { minPrice = price; } else if (price - minPrice > maxProfit) { maxProfit = price - minPrice; } } return maxProfit;}def max_profit(prices): min_price = float('inf') max_profit = 0 for price in prices: if price < min_price: min_price = price elif price - min_price > max_profit: max_profit = price - min_price return max_profitDifficulty: Hard
Time: 45 minutes
Find median of two sorted arrays in O(log(m+n)).
Input: nums1 = [1,3], nums2 = [2]
Output: 2.0
public double findMedianSortedArrays(int[] nums1, int[] nums2) { if (nums1.length > nums2.length) { return findMedianSortedArrays(nums2, nums1); } int m = nums1.length, n = nums2.length; int low = 0, high = m;
while (low <= high) { int partitionX = (low + high) / 2; int partitionY = (m + n + 1) / 2 - partitionX;
int maxLeftX = partitionX == 0 ? Integer.MIN_VALUE : nums1[partitionX - 1]; int minRightX = partitionX == m ? Integer.MAX_VALUE : nums1[partitionX]; int maxLeftY = partitionY == 0 ? Integer.MIN_VALUE : nums2[partitionY - 1]; int minRightY = partitionY == n ? Integer.MAX_VALUE : nums2[partitionY];
if (maxLeftX <= minRightY && maxLeftY <= minRightX) { if ((m + n) % 2 == 0) { return (Math.max(maxLeftX, maxLeftY) + Math.min(minRightX, minRightY)) / 2.0; } return Math.max(maxLeftX, maxLeftY); } else if (maxLeftX > minRightY) { high = partitionX - 1; } else { low = partitionX + 1; } } return 0.0;}def find_median_sorted_arrays(nums1, nums2): if len(nums1) > len(nums2): nums1, nums2 = nums2, nums1
m, n = len(nums1), len(nums2) low, high = 0, m
while low <= high: partition_x = (low + high) // 2 partition_y = (m + n + 1) // 2 - partition_x
max_left_x = float('-inf') if partition_x == 0 else nums1[partition_x - 1] min_right_x = float('inf') if partition_x == m else nums1[partition_x] max_left_y = float('-inf') if partition_y == 0 else nums2[partition_y - 1] min_right_y = float('inf') if partition_y == n else nums2[partition_y]
if max_left_x <= min_right_y and max_left_y <= min_right_x: if (m + n) % 2 == 0: return (max(max_left_x, max_left_y) + min(min_right_x, min_right_y)) / 2 return max(max_left_x, max_left_y) elif max_left_x > min_right_y: high = partition_x - 1 else: low = partition_x + 1 return 0Difficulty: Medium
Time: 25 minutes
Group anagrams together.
Input: [“eat”,“tea”,“tan”,“ate”,“nat”,“bat”]
Output: [[“bat”],[“nat”,“tan”],[“ate”,“eat”,“tea”]]
public List<List<String>> groupAnagrams(String[] strs) { Map<String, List<String>> map = new HashMap<>(); for (String s : strs) { char[] chars = s.toCharArray(); Arrays.sort(chars); String key = new String(chars); map.computeIfAbsent(key, k -> new ArrayList<>()).add(s); } return new ArrayList<>(map.values());}from collections import defaultdict
def group_anagrams(strs): anagrams = defaultdict(list) for s in strs: key = ''.join(sorted(s)) anagrams[key].append(s) return list(anagrams.values())Difficulty: Medium
Time: 30 minutes
Find length of longest increasing subsequence.
Input: [10,9,2,5,3,7,101,18]
Output: 4 ([2,3,7,101])
public int lengthOfLIS(int[] nums) { int[] tails = new int[nums.length]; int size = 0; for (int num : nums) { int left = 0, right = size; while (left < right) { int mid = (left + right) / 2; if (tails[mid] < num) left = mid + 1; else right = mid; } tails[left] = num; if (left == size) size++; } return size;}import bisect
def length_of_lis(nums): tails = [] for num in nums: pos = bisect.bisect_left(tails, num) if pos == len(tails): tails.append(num) else: tails[pos] = num return len(tails)Difficulty: Medium
Time: 35 minutes
Design LRU Cache with O(1) get and put.
from collections import OrderedDict
class LRUCache: def __init__(self, capacity): self.cache = OrderedDict() self.capacity = capacity
def get(self, key): if key not in self.cache: return -1 self.cache.move_to_end(key) return self.cache[key]
def put(self, key, value): if key in self.cache: self.cache.move_to_end(key) self.cache[key] = value if len(self.cache) > self.capacity: self.cache.popitem(last=False)GS 2025 Papers
Latest papers. View 2025 Papers →
GS Coding Questions
25+ problems. View Coding →
GS Preparation
Complete strategy. View Guide →
Complete Guide
Full guide. View Guide →
Prepare DSA + basic finance for Goldman Sachs!
Last updated: February 2026