Autocoder

Goldman Sachs interview questions with answers (engineering analyst)

Last updated 2026-11-19

Goldman Sachs hires engineers in India as analysts and associates, mainly in Bengaluru and Hyderabad. Its interviews are known for leaning on data structures, probability and short logic problems alongside CS fundamentals, so a prepared candidate needs more than memorised coding patterns.

The twelve questions below mix technical and HR topics in the style such interviews commonly follow, each with a worked answer. They are practice material, not past questions. For the online test itself, use Goldman Sachs coding round questions.

Typical rolesEngineering Analyst, Associate (India: Bengaluru, Hyderabad)
Rounds, as commonly reportedOnline coding test, then technical interviews and a final set of back-to-back interviews
Heavy topicsDSA, probability and puzzles, OOP, SQL, OS and DBMS
Hiring newsSee Hiring status below

Rounds as commonly reported

Candidates commonly report an online assessment with coding problems on a platform such as HackerRank, sometimes with CS and aptitude questions, followed by technical interviews, and then a final stage of several interviews in one day, often called a Superday, mixing technical and behavioural questions. Rounds, platforms and order change between cycles and roles, so treat this as a typical pattern rather than a fixed process.

Technical interviews usually involve coding in a shared editor while you talk through your approach. Interviewers often change the constraints partway through, for instance asking what changes if the input no longer fits in memory, so practise explaining trade-offs and not only getting the code to pass.

What to prepare

Hiring status

For news that changes month to month, see Goldman Sachs hiring, which is updated from sourced reports. This page keeps only the facts below, each with its source.

Apply only through Goldman Sachs's own careers site, and confirm eligibility and dates there.

Goldman Sachs interview questions with answers (engineering analyst): questions with worked answers

  1. 1

    Explain how a HashMap handles collisions and why the hashCode and equals contract matters.

    medium

    A HashMap hashes the key to pick a bucket. Keys that land in the same bucket are chained in a linked list, which Java 8 converts to a balanced tree once a bucket grows past 8 entries. Lookup compares the hash first and then calls equals. If two equal objects return different hash codes, they go to different buckets and get() misses a key that is present. If you override equals you must override hashCode so equal objects share a hash. Average get and put are O(1); the worst case is O(log n) with tree bins. Resizing at a 0.75 load factor rehashes every entry.

    java
    import java.util.*;
    class Point {
        final int x, y;
        Point(int x, int y) { this.x = x; this.y = y; }
        @Override public boolean equals(Object o) {
            if (!(o instanceof Point)) return false;
            Point p = (Point) o;
            return x == p.x && y == p.y;
        }
        @Override public int hashCode() { return Objects.hash(x, y); }
    }
  2. 2

    Reverse a singly linked list in place and state the complexity.

    easy

    Walk the list once, keeping prev, curr and next pointers. Save curr.next, point curr.next at prev, then advance both. When curr is null, prev is the new head. Time is O(n) and extra space is O(1). The usual slip is losing the rest of the list by overwriting curr.next before saving it. Be ready for the follow-up of reversing it recursively (O(n) stack space) or reversing only nodes m to n.

    python
    def reverse(head):
        prev = None
        while head:
            nxt = head.next
            head.next = prev
            prev, head = head, nxt
        return prev
  3. 3

    What is the difference between a process and a thread, and what are the four conditions for deadlock?

    medium

    A process has its own address space and resources; threads inside a process share its heap, code and open files but have their own stack and registers, so switching threads is cheaper and sharing data needs synchronisation. Deadlock needs all four Coffman conditions together: mutual exclusion, hold and wait, no pre-emption, and circular wait. Breaking any one prevents it. The practical fix interviewers like is a global lock ordering, which removes circular wait. Mention that a race condition is a different bug: it needs no waiting at all.

  4. 4

    Write SQL to find the second highest salary in an Employee table, including the case where it does not exist.

    medium

    DENSE_RANK handles ties properly: two people on the top salary do not push the second-highest value out of range. Wrapping the result in an aggregate returns NULL, rather than no row, when there is no second salary. The alternative, LIMIT 1 OFFSET 1 on DISTINCT salaries, needs the same wrapper. See SQL window functions interview questions for ranking variants.

    sql
    SELECT MAX(salary) AS second_highest
    FROM (
      SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
      FROM Employee
    ) t
    WHERE rnk = 2;
  5. 5

    You roll a fair die repeatedly until you get a six. What is the expected number of rolls?

    medium

    Let E be the expectation. With probability 1/6 you stop after one roll; otherwise you have used one roll and are back at the start. So E = 1 + (5/6)E, which gives E/6 = 1, so E = 6. This is the mean of a geometric distribution with p = 1/6. Generalising to E = 1/p is the point: expect the same style of question with coins or cards. Practise more in probability aptitude questions.

  6. 6

    There are 100 closed doors and 100 people. Person k toggles every k-th door. Which doors are open at the end?

    easy

    Door n is toggled once for every divisor of n. It ends open only if it has an odd number of divisors, which happens exactly when n is a perfect square because divisors pair up as (d, n/d) except when d equals n/d. So doors 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100 are open: ten doors. Say the reasoning aloud; the number alone is not what is being tested.

  7. 7

    Quicksort is O(n log n) on average. When does it degrade, and how do you avoid that?

    medium

    It degrades to O(n^2) when the pivot repeatedly splits the array into sizes 0 and n-1, for example picking the first element of an already sorted array. Random pivot selection or median-of-three makes that unlikely, and recursing into the smaller partition first keeps stack depth at O(log n). Quicksort is in place but not stable. If stability or guaranteed O(n log n) matters, use merge sort at the cost of O(n) extra space.

  8. 8

    Design an LRU cache with O(1) get and put. Which data structures do you pick?

    hard

    Combine a hash map from key to node with a doubly linked list ordered by recency. get moves the node to the front; put inserts at the front and, when over capacity, removes the tail node and its map entry. The map gives O(1) lookup and the doubly linked list gives O(1) removal and reinsertion given a node reference. In Java, LinkedHashMap with accessOrder true and an overridden removeEldestEntry does the same job, but be ready to build it by hand. The full coded version is in Goldman Sachs coding round questions.

  9. 9

    What is the difference between an abstract class and an interface in Java, and when do you use each?

    easy

    An interface declares a contract and, since Java 8, may include default and static methods but no instance state; a class can implement many. An abstract class can hold fields, constructors and partial implementation, but a class extends only one. Use an interface for a capability that unrelated classes share (Comparable), and an abstract class when subclasses share state and base behaviour. In a trading context, an Order interface with several implementations and a shared AbstractOrder for common validation is a sensible example.

  10. 10

    Explain ACID properties with a funds-transfer example.

    medium

    Moving 1,000 from account A to B must debit and credit together (atomicity), leave the total balance and constraints valid (consistency), not expose a half-done state to concurrent transactions (isolation), and survive a crash once committed (durability). Isolation is implemented with locks or MVCC and has levels from read committed to serialisable, trading anomalies such as dirty and phantom reads against throughput. Finance interviewers often follow up on what happens if the debit succeeds and the credit fails: roll back the transaction.

  11. 11

    Why Goldman Sachs, and why engineering rather than a markets role?

    easy

    A good answer connects three things you can defend: the kind of problem (low-latency systems, risk calculation, large-scale data), something specific you have built or studied that relates, and what you want to learn in the first two years. Avoid reciting the firm's size or brand. Reference one public thing, such as the firm's engineering work or a division, only if you have actually read about it. Keep it to about a minute and end on the contribution you expect to make.

  12. 12

    Tell me about a time you disagreed with a teammate on a technical decision.

    medium

    Use the STAR shape: a specific project, the two options and what each risked, how you tested the disagreement (a small benchmark, a prototype, a written trade-off), the outcome and what changed in how you work afterwards. Superday interviewers listen for whether you argued from evidence and whether you could commit once the team decided, even if your option lost. Do not make the other person the villain, and do not pick an example with no technical content.

  13. 13

    Tell me about a project where something failed close to a deadline.

    medium

    Pick a real failure: a bug found late, an integration that did not work, a misjudged estimate. Explain what you did in the first hour (reproduce, scope the blast radius, tell the people affected), the decision you made on cutting scope or fixing forward, and the specific habit you added afterwards, such as tests around the failing path or an earlier integration check. Owning your part of the cause plainly is worth more than an impressive recovery story.

Frequently asked questions

Does Goldman Sachs ask puzzles and probability questions?

Candidates commonly report probability, expectation and short logic puzzles in technical rounds for engineering roles, alongside data structures. Prepare the standard ones and be able to explain the reasoning, since interviewers follow up on the method.

Which language should I use in a Goldman Sachs interview?

Use the one you can write correctly under pressure. Java and Python are both common choices. What matters is clean code, edge cases and stated complexity.

How many interview rounds are there?

There is no published count. Candidates commonly describe an online test followed by technical interviews and a final stage of several interviews, but the number and format vary by role and cycle.

Where can I check current Goldman Sachs openings?

Use the Goldman Sachs careers site and the sourced notes in the Goldman Sachs hiring page. This guide does not quote any dates or numbers beyond those sources.

Sources

Related guides

More in Company Interview Questions

See all in this section