Reported September 2024
JP Morganhash table

Get Unique Character

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

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

JP Morgan's September OA included a string manipulation problem that looks deceptively simple on the surface. You're asked to extract or identify unique characters from a string, but the real test is handling edge cases cleanly and doing it efficiently. Most candidates overthink it or miss a subtle constraint. StealthCoder will catch your logic if you blank on the implementation, but the pattern itself is straightforward once you see it.

Pattern and pitfall

This is a hash-table play disguised as a string problem. The core move is iterate through the string once, track character frequency or presence in a set or dictionary, then return the unique characters in order (or just count them, depending on the exact ask). The pitfall: candidates assume order doesn't matter, then the problem quietly requires it. Another trap is forgetting to handle duplicates explicitly instead of relying on implicit set behavior. The algorithm is O(n) time, O(k) space where k is the alphabet size. If you're stuck live during the OA, StealthCoder reads the exact requirement off screen and feeds you the skeleton.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Get Unique Character 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as first unique character in a string. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass JP Morgan's OA.

JP Morgan reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Unique Character FAQ

Does 'unique' mean first occurrence only, or count all non-duplicated chars?+

The problem likely wants you to return characters that appear exactly once, OR characters that appear in order without repetition. Test both interpretations locally. The problem text will clarify, but if it doesn't, ask yourself: does the expected output show 'abc' or 'a'? That tells you which definition applies.

Can I just use a set and lose order?+

Not safely. JP Morgan's OA usually cares about output order. Use a dictionary or list to preserve insertion order. Python 3.7+ dicts maintain insertion order by default, which is your friend here. JavaScript Map also preserves insertion order.

What's the gotcha with this problem?+

The gotcha is the exact definition of 'unique' and whether case sensitivity matters. 'A' and 'a' are different characters. Also watch for whitespace or special characters. The problem looks trivial until you misread the requirements, then you fail on one test case.

Is this problem still asked in 2024?+

Yes. String and hash-table fundamentals never go out of style at JP Morgan. This is a warm-up or early problem in the OA. Solve it fast and move to the harder ones.

How do I prepare in 48 hours?+

Code this three times in your target language. Once with a set, once with a dictionary, once with a list. Understand which data structure answers which variant. Then stop and trust it. Over-drilling will make you second-guess yourself live.

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

OA at JP Morgan?
Invisible during screen share
Get it