Reported January 2024
Goldman Sachs

Compare Strings

Reported by candidates from Goldman Sachs's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Goldman Sachs OA. Under 2s to a working solution.
Founder's read

Goldman Sachs hit you with Compare Strings in January 2024, and you've got no problem text. That's the real test. This is a pattern-matching problem, and the trick is always the same: you're comparing two strings under some constraint, usually alphabetical order or character frequency. The OA expects you to spot the rule fast and code it faster. StealthCoder will read the problem on screen and show you the pattern in seconds if you blank during the live assessment.

Pattern and pitfall

Compare Strings problems almost always boil down to one of three things: lexicographic ordering, character-by-character matching, or frequency counting. The common pitfall is overthinking edge cases like empty strings, case sensitivity, or special characters. Most candidates waste time building a custom comparator when the language's built-in sort does it already. The algorithmic core is simple: define what 'compare' means, apply it consistently, return the result. If Goldman is asking this, they're testing whether you can read a problem statement, extract the rule, and implement it cleanly under pressure. That's where StealthCoder becomes your safety net. If you freeze on the exact comparison logic during the live OA, you have a real-time solution to unblock.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Compare Strings cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Goldman Sachs's OA.

Goldman Sachs reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Compare Strings FAQ

Is this a string sort or a pairwise comparison problem?+

Without the full text, assume it's asking you to compare two specific strings and return a result (like -1, 0, 1) rather than sort an array. Goldman tends to ask for the foundational comparison logic. If it's arrays of strings, you'd use that comparator in a sort.

What's the trick Goldman usually wants to see?+

Clean, readable code that handles the comparison rule exactly as stated. They're not testing for a clever algorithm. They're testing for attention to detail and the ability to implement a specification without overcomplicating it. Read the rule twice.

How do I prepare in 48 hours if I've never seen the full problem?+

Review the three-way comparator pattern (return -1, 0, or 1). Understand lexicographic ordering. Practice comparing strings by length, alphabetical order, and custom rules. If you hit this in the OA, the problem text will make the rule clear. Trust the statement.

Are there edge cases I should worry about?+

Yes. Empty strings, case sensitivity, and whether comparison is case-sensitive or not. Also check if one string is a substring of another. Re-read the problem statement for exactly what 'compare' means in their context.

Does Goldman test this pattern frequently?+

String comparison and ordering show up across most tech interviews, especially at trading firms and financial tech companies. Goldman definitely uses it as a baseline test for coding clarity. Expect it to be straightforward, not a trick question.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Goldman Sachs.

OA at Goldman Sachs?
Invisible during screen share
Get it