← 返回博客列表
Goldman Sachs

Goldman Sachs OA Real Questions

2025-09-28

Goldman Sachs OA focuses on financial scenario algorithms and data structures. This article shares the latest OA questions. oavoservice helps you get the Offer.

📋 Question 1: Best Time to Buy and Sell Stock

def maxProfit(prices):
    if not prices:
        return 0
    
    min_price = float('inf')
    max_profit = 0
    
    for price in prices:
        min_price = min(min_price, price)
        max_profit = max(max_profit, price - min_price)
    
    return max_profit

📋 Question 2: Merge Intervals

def merge(intervals):
    if not intervals:
        return []
    
    intervals.sort(key=lambda x: x[0])
    merged = [intervals[0]]
    
    for current in intervals[1:]:
        if current[0] <= merged[-1][1]:
            merged[-1][1] = max(merged[-1][1], current[1])
        else:
            merged.append(current)
    
    return merged

📋 Question 3: LRU Cache

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)

💼 How oavoservice Helps

Financial Scenarios - Trading Algorithms Data Structures - Advanced Data Structures Code Quality - Financial Grade Code Standards Time Management - Efficient Answering Strategy

Contact oavoservice for professional Finance OA assistance!


Tags: #GoldmanSachs #OA #FinTech #LRU #OAHelp #InterviewPrep #1point3acres


Need real interview questions? Contact WeChat Coding0201 immediately to get real questions.