Find Niceness
Reported by candidates from Goldman Sachs's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Goldman Sachs asked this in March 2024 and it caught people off guard because the problem name doesn't telegraph what you're actually solving. You get an array or list of numbers, and you need to compute a 'niceness' score based on some property of the data. The trick is figuring out what niceness actually measures. Most candidates waste time guessing the formula instead of reverse-engineering it from examples. Have StealthCoder on your screen during the OA and you'll see the pattern in seconds instead of minutes.
Pattern and pitfall
Without the exact problem text, the pattern is likely one of three things: a sum-based metric (prefix sums or cumulative scoring), a counting problem (how many pairs or elements satisfy a condition), or a sorting-dependent calculation (the order matters). The 'niceness' framing suggests you're scoring based on relationships between elements, not individual properties. Common pitfall: candidates hardcode logic for one test case and fail on others. The hedge is to identify the scoring rule from the first example, code it cleanly, then verify on a second example before submitting. If you blank on the formula during the live OA, StealthCoder will show you the working solution so you can trace backwards and understand the pattern.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Find Niceness 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Goldman Sachs's OA.
Goldman Sachs reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Niceness FAQ
What does 'niceness' actually mean in this problem?+
Without the full problem statement, niceness is most likely a metric that scores how elements in the array relate to each other. It could be based on pairs, inversions, differences, or cumulative sums. The first example will reveal the formula. Read the examples before you code anything.
Is this a sorting problem or a calculation problem?+
Both are possible. If niceness depends on the order of elements, you may need to sort first. If it's purely a positional metric (e.g., sum of products with indices), sort doesn't apply. Check whether rearranging the array changes the output. That tells you if order matters.
How do I reverse-engineer the formula from one example?+
Write out the input array and the expected output. Then try simple rules: sum of elements, count of pairs, sum of absolute differences, count of inversions. Plug each rule into the example. Whichever one produces the output is your answer. Code that rule and test on the second example.
What's the most common mistake on Goldman Sachs scoring problems?+
Overthinking the formula and coding a complex solution when the rule is simple. Candidates also ignore edge cases like empty arrays or single elements. Read all examples carefully, code the simplest rule that fits, then handle edge cases explicitly.
Can I solve this in under 20 minutes if I blank?+
Yes, if you reverse-engineer from examples first and don't try to guess. Spend 5 minutes on examples, 10 minutes coding, 5 minutes testing. If you truly blank on the formula, that's what StealthCoder is there for during the live OA.